linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: david@fromorbit.com, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/7] xfs: clear reflink flag if setting realtime flag
Date: Mon, 10 Oct 2016 11:10:16 -0700	[thread overview]
Message-ID: <20161010181016.GB22379@birch.djwong.org> (raw)
In-Reply-To: <20161010124437.GA18495@bfoster.bfoster>

On Mon, Oct 10, 2016 at 08:44:39AM -0400, Brian Foster wrote:
> On Fri, Oct 07, 2016 at 04:08:03PM -0700, Darrick J. Wong wrote:
> > Since we can only turn on the rt flag if there are no data extents,
> > we can safely turn off the reflink flag if the rt flag is being
> > turned on.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > Reported-by: Brian Foster <bfoster@redhat.com>
> > ---
> >  fs/xfs/xfs_ioctl.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> > index 8b9f31c5..598b97b 100644
> > --- a/fs/xfs/xfs_ioctl.c
> > +++ b/fs/xfs/xfs_ioctl.c
> > @@ -1034,9 +1034,9 @@ xfs_ioctl_setattr_xflags(
> >  			return -EINVAL;
> >  	}
> >  
> > -	/* Don't allow us to set realtime mode for a reflinked file. */
> > +	/* Clear reflink if we are actually able to set the rt flag. */
> >  	if ((fa->fsx_xflags & FS_XFLAG_REALTIME) && xfs_is_reflink_inode(ip))
> > -		return -EINVAL;
> > +		ip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK;
> >  
> >  	/* Don't allow us to set DAX mode for a reflinked file for now. */
> >  	if ((fa->fsx_xflags & FS_XFLAG_DAX) && xfs_is_reflink_inode(ip))
> 
> This seems fine to me, but don't we still have the original problem in
> the code that shortly follows with regard to the DAX flag? In other
> words, the fundamental issue was that we clear the reflink flag lazily
> (which by itself is perfectly fine), but we have a few spots where we
> trust that the inode absolutely has shared extents when the flag is set.
> 
> That also might be fine logic in certain contexts, but in these couple
> cases we fail requested operations from the user (setting RT, DAX,
> etc.). It's not a big deal in that I suppose one can always run an
> unshare fallocate, but just could be confusing if somebody is aware of
> the already unshared state of a file.
> 
> Could we invoke xfs_reflink_clear_inode_flag() somewhere earlier in this
> path if the reflink flag is set and any of the conflicting flags have
> been requested by the user?

Seems reasonable.  I'll work on a patch.

--D

> 
> Brian
> 
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2016-10-10 18:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 23:07 [PATCH 0/7] xfs: reflink fixes Darrick J. Wong
2016-10-07 23:07 ` [PATCH 1/7] xfs: rework refcount cow recovery error handling Darrick J. Wong
2016-10-10  5:37   ` Dave Chinner
2016-10-10  6:10     ` Darrick J. Wong
2016-10-10  6:11   ` [PATCH v2 " Darrick J. Wong
2016-10-10 10:21     ` Christoph Hellwig
2016-10-10 18:21       ` Darrick J. Wong
2016-10-10 20:25         ` Dave Chinner
2016-10-10 21:46           ` Darrick J. Wong
2016-10-07 23:07 ` [PATCH 2/7] xfs: check inode reflink flag before calling reflink functions Darrick J. Wong
2016-10-10  5:24   ` Dave Chinner
2016-10-10 10:18   ` Christoph Hellwig
2016-10-07 23:07 ` [PATCH 3/7] xfs: reduce stack usage of _reflink_clear_inode_flag Darrick J. Wong
2016-10-10  5:25   ` Dave Chinner
2016-10-10 10:17   ` Christoph Hellwig
2016-10-07 23:07 ` [PATCH 4/7] xfs: remove isize check from unshare operation Darrick J. Wong
2016-10-10  5:26   ` Dave Chinner
2016-10-10 10:21   ` Christoph Hellwig
2016-10-07 23:07 ` [PATCH 5/7] xfs: fix label inaccuracies Darrick J. Wong
2016-10-10  5:27   ` Dave Chinner
2016-10-10 10:22   ` Christoph Hellwig
2016-10-07 23:07 ` [PATCH 6/7] xfs: fix error initialization Darrick J. Wong
2016-10-08 15:55   ` Eric Sandeen
2016-10-10  5:36     ` Dave Chinner
2016-10-10 10:23     ` Christoph Hellwig
2016-10-07 23:08 ` [PATCH 7/7] xfs: clear reflink flag if setting realtime flag Darrick J. Wong
2016-10-10  5:29   ` Dave Chinner
2016-10-10 10:24   ` Christoph Hellwig
2016-10-10 12:25     ` Dave Chinner
2016-10-10 12:45       ` Christoph Hellwig
2016-10-10 12:59         ` Dave Chinner
2016-10-10 17:18         ` Darrick J. Wong
2016-10-10 12:44   ` Brian Foster
2016-10-10 18:10     ` Darrick J. Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161010181016.GB22379@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).