[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170725192051.459719320@linuxfoundation.org>
Date: Tue, 25 Jul 2017 12:21:41 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Tom Yan <tom.ty89@...look.com>,
Jaegeuk Kim <jaegeuk@...nel.org>
Subject: [PATCH 4.12 102/196] f2fs: load inodes flag from disk
4.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jaegeuk Kim <jaegeuk@...nel.org>
commit 93607124c5450148e592c3d18ac533b4e5f25b8b upstream.
This patch fixes missing inode flag loaded from disk, reported by Tom.
[tom@...alhost ~]$ sudo mount /dev/loop0 /mnt/
[tom@...alhost ~]$ sudo chown tom:tom /mnt/
[tom@...alhost ~]$ touch /mnt/testfile
[tom@...alhost ~]$ sudo chattr +i /mnt/testfile
[tom@...alhost ~]$ echo test > /mnt/testfile
bash: /mnt/testfile: Operation not permitted
[tom@...alhost ~]$ rm /mnt/testfile
rm: cannot remove '/mnt/testfile': Operation not permitted
[tom@...alhost ~]$ sudo umount /mnt/
[tom@...alhost ~]$ sudo mount /dev/loop0 /mnt/
[tom@...alhost ~]$ lsattr /mnt/testfile
----i-------------- /mnt/testfile
[tom@...alhost ~]$ echo test > /mnt/testfile
[tom@...alhost ~]$ rm /mnt/testfile
[tom@...alhost ~]$ sudo umount /mnt/
Reported-by: Tom Yan <tom.ty89@...look.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/f2fs/file.c | 1 +
fs/f2fs/inode.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1493,6 +1493,7 @@ static int f2fs_ioc_setflags(struct file
inode->i_ctime = current_time(inode);
f2fs_set_inode_flags(inode);
+ f2fs_mark_inode_dirty_sync(inode, false);
inode_unlock(inode);
out:
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -44,7 +44,6 @@ void f2fs_set_inode_flags(struct inode *
new_fl |= S_DIRSYNC;
inode_set_flags(inode, new_fl,
S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
- f2fs_mark_inode_dirty_sync(inode, false);
}
static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri)
@@ -226,6 +225,7 @@ make_now:
ret = -EIO;
goto bad_inode;
}
+ f2fs_set_inode_flags(inode);
unlock_new_inode(inode);
trace_f2fs_iget(inode);
return inode;
Powered by blists - more mailing lists