> Sent: Monday, March 12, 2018 at 3:07 PM > From: "Yan, Zheng" <ukernel@xxxxxxxxx> > To: "Chengguang Xu" <cgxu519@xxxxxxx> > Cc: "Zheng Yan" <zyan@xxxxxxxxxx>, "Ilya Dryomov" <idryomov@xxxxxxxxx>, ceph-devel <ceph-devel@xxxxxxxxxxxxxxx> > Subject: Re: [PATCH v2] ceph: sync metadata when having I_DIRTY_DATASYNC flag in fdatasync > > On Sun, Mar 11, 2018 at 8:41 PM, Chengguang Xu <cgxu519@xxxxxxx> wrote: > > Add more condition checks for syncing metadata in fsync/fdatasync. > > 1) if inode is clean then skip metadata sync. > > 2) if inode is marked I_DIRTY_DATASYNC flag, then should sync metadata > > even in fdatasync. > > > > Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx> > > --- > > Changes since v1: > > - if inode is clean then skip metadata sync. > > > > fs/ceph/caps.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c > > index 0e5bd3e..d5e4e49 100644 > > --- a/fs/ceph/caps.c > > +++ b/fs/ceph/caps.c > > @@ -2170,7 +2170,10 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync) > > if (ret < 0) > > goto out; > > > > - if (datasync) > > + if (!(inode->i_state & I_DIRTY_ALL)) > > + goto out; > > + > > + if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) > > goto out; > > fsync also waits unsafe mds request. we don't mark inode dirty for > unsafe request How about change nothing in the ceph_fsync() and delete the code which never be executed in __ceph_mark_dirty_caps()? Thanks, Chengguang. -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html