[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210111145633.GE18475@quack2.suse.cz>
Date: Mon, 11 Jan 2021 15:56:33 +0100
From: Jan Kara <jack@...e.cz>
To: Eric Biggers <ebiggers@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net,
Theodore Ts'o <tytso@....edu>, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v2 06/12] fs: pass only I_DIRTY_INODE flags to
->dirty_inode
On Fri 08-01-21 23:58:57, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
>
> ->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.
>
> Reviewed-by: Christoph Hellwig <hch@....de>
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> Documentation/filesystems/vfs.rst | 5 ++++-
> fs/fs-writeback.c | 2 +-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
> index ca52c82e5bb54..287b80948a40b 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 b7616bbd55336..2e6064012f7d3 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -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);
>
> --
> 2.30.0
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists