This is a note to let you know that I've just added the patch titled f2fs: load inode's flag from disk to the 4.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-load-inode-s-flag-from-disk.patch and it can be found in the queue-4.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 93607124c5450148e592c3d18ac533b4e5f25b8b Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Date: Tue, 16 May 2017 13:20:16 -0700 Subject: f2fs: load inode's flag from disk From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> commit 93607124c5450148e592c3d18ac533b4e5f25b8b upstream. This patch fixes missing inode flag loaded from disk, reported by Tom. [tom@localhost ~]$ sudo mount /dev/loop0 /mnt/ [tom@localhost ~]$ sudo chown tom:tom /mnt/ [tom@localhost ~]$ touch /mnt/testfile [tom@localhost ~]$ sudo chattr +i /mnt/testfile [tom@localhost ~]$ echo test > /mnt/testfile bash: /mnt/testfile: Operation not permitted [tom@localhost ~]$ rm /mnt/testfile rm: cannot remove '/mnt/testfile': Operation not permitted [tom@localhost ~]$ sudo umount /mnt/ [tom@localhost ~]$ sudo mount /dev/loop0 /mnt/ [tom@localhost ~]$ lsattr /mnt/testfile ----i-------------- /mnt/testfile [tom@localhost ~]$ echo test > /mnt/testfile [tom@localhost ~]$ rm /mnt/testfile [tom@localhost ~]$ sudo umount /mnt/ Reported-by: Tom Yan <tom.ty89@xxxxxxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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; Patches currently in stable-queue which might be from jaegeuk@xxxxxxxxxx are queue-4.12/f2fs-load-inode-s-flag-from-disk.patch queue-4.12/f2fs-don-t-clear-sgid-when-inheriting-acls.patch queue-4.12/f2fs-use-spin_-un-lock_irq-save-restore.patch queue-4.12/f2fs-sanity-check-checkpoint-segno-and-blkoff.patch queue-4.12/f2fs-sanity-check-size-of-nat-and-sit-cache.patch queue-4.12/f2fs-try-to-freeze-in-gc-and-discard-threads.patch queue-4.12/f2fs-wake-up-all-waiters-in-f2fs_submit_discard_endio.patch queue-4.12/f2fs-do-not-issue-small-discards-in-lfs-mode.patch