mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-19 12:24:34 +08:00
fs: pass only I_DIRTY_INODE flags to ->dirty_inode
->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@kernel.org Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
e2728c5621
commit
a38ed483a7
@ -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
|
||||
|
@ -2259,7 +2259,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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user