Patch "fs: pass only I_DIRTY_INODE flags to ->dirty_inode" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fs: pass only I_DIRTY_INODE flags to ->dirty_inode

to the 5.10-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:
     fs-pass-only-i_dirty_inode-flags-to-dirty_inode.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a0b3b58097f66aa6b33340b0962ff0ee41da9c60
Author: Eric Biggers <ebiggers@xxxxxxxxxx>
Date:   Tue Jan 12 11:02:48 2021 -0800

    fs: pass only I_DIRTY_INODE flags to ->dirty_inode
    
    [ Upstream commit a38ed483a72672ee6bdb5d8cf17fc0838377baa0 ]
    
    ->dirty_inode is now only called when I_DIRTY_INODE (I_DIRTY_SYNC and/or
    I_DIRTY_DATASYNC) is set.  However it may still be passed other dirty
    flags at the same time, provided that these other flags happened to be
    passed to __mark_inode_dirty() at the same time as I_DIRTY_INODE.
    
    This doesn't make sense because there is no reason for filesystems to
    care about these extra flags.  Nor are filesystems notified about all
    updates to these other flags.
    
    Therefore, mask the flags before passing them to ->dirty_inode.
    
    Also properly document ->dirty_inode in vfs.rst.
    
    Link: https://lore.kernel.org/r/20210112190253.64307-7-ebiggers@xxxxxxxxxx
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Reviewed-by: Jan Kara <jack@xxxxxxx>
    Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
    Signed-off-by: Jan Kara <jack@xxxxxxx>
    Stable-dep-of: cbfecb927f42 ("fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
index ca52c82e5bb5..287b80948a40 100644
--- a/Documentation/filesystems/vfs.rst
+++ b/Documentation/filesystems/vfs.rst
@@ -270,7 +270,10 @@ or bottom half).
 	->alloc_inode.
 
 ``dirty_inode``
-	this method is called by the VFS to mark an inode dirty.
+	this method is called by the VFS when an inode is marked dirty.
+	This is specifically for the inode itself being marked dirty,
+	not its data.  If the update needs to be persisted by fdatasync(),
+	then I_DIRTY_DATASYNC will be set in the flags argument.
 
 ``write_inode``
 	this method is called when the VFS needs to write an inode to
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 2088046de4ef..b6d572a519fa 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -2246,7 +2246,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
 		trace_writeback_dirty_inode_start(inode, flags);
 
 		if (sb->s_op->dirty_inode)
-			sb->s_op->dirty_inode(inode, flags);
+			sb->s_op->dirty_inode(inode, flags & I_DIRTY_INODE);
 
 		trace_writeback_dirty_inode(inode, flags);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux