linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	Jan Kara <jack@suse.com>, Al Viro <viro@zeniv.linux.org.uk>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	mfasheh@versity.com, linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [RFC][PATCH v2 4/4] vfs: wrap write f_ops with file_{start,end}_write()
Date: Fri, 27 Jan 2017 08:31:41 -0800	[thread overview]
Message-ID: <20170127163141.GG2584@birch.djwong.org> (raw)
In-Reply-To: <CAOQ4uxiVvhkqg5dUjRvvXr1d9K46Wp8yoXg4+abShdH0ae71NA@mail.gmail.com>

[adding mfasheh & btrfs list to cc]

On Fri, Jan 27, 2017 at 06:20:12PM +0200, Amir Goldstein wrote:
> On Fri, Jan 27, 2017 at 1:50 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> > On Fri, Jan 27, 2017 at 1:09 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
> >> On Mon, Jan 23, 2017 at 8:43 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> >>> Before calling write f_ops, call file_start_write() instead
> >>> of sb_start_write().
> >>>
> >>> This ensures freeze protection for both overlay and upper fs
> >>> when file is open from an overlayfs mount.
> >>>
> >>> Replace {sb,file}_start_write() for {copy,clone}_file_range() and
> >>> for fallocate().
> >>>
> >>> For dedup_file_range() there is no need for mnt_want_write_file().
> >>> File is already open for write, so we already have mnt_want_write()
> >>> and we only need file_start_write().
> >>
> >> Being opened for write is not verified if capable(CAP_SYS_ADMIN).
> >> Ugly special case, don't ask me why it's done...
> >>
> >
> > Christoph, Darrick, is that by design?
> 
> Anyway, whether is makes sense or not, that's a legacy from
> BTRFS_IOC_FILE_EXTENT_SAME, we probably have to live with.
> 
> Michael, I recon man page needs updating.
> 
> I'll remove this hunk from the patch.

I /think/ that behavior (CAP_SYS_ADMIN not requiring destfd to be open
for writes in order to dedupe) was intentional; it seems to date back to
the original ioctl in 2013.  My guess of the justification is that we're
not really writing to dest, so if the admin comes along with an O_RDONLY
destfd it's ok?

<shrug> Let's see if we get any bites from the btrfs developers. :)

--D

  reply	other threads:[~2017-01-27 16:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 12:32 [RFC][PATCH v2 0/3] overlayfs: support freeze/thaw/syncfs Amir Goldstein
2017-01-23 12:32 ` [RFC][PATCH v2 1/3] vfs: freeze protect overlay inode on file_start_write() Amir Goldstein
2017-01-23 19:43   ` [RFC][PATCH v2 4/4] vfs: wrap write f_ops with file_{start,end}_write() Amir Goldstein
2017-01-24 10:09     ` Jan Kara
2017-01-27 11:09     ` Miklos Szeredi
2017-01-27 11:50       ` Amir Goldstein
2017-01-27 16:20         ` Amir Goldstein
2017-01-27 16:31           ` Darrick J. Wong [this message]
2017-01-27 17:29           ` Amir Goldstein
2017-01-27 17:51             ` Christoph Hellwig
2017-01-27 19:30           ` Michael Kerrisk (man-pages)
2017-01-27 20:09             ` Amir Goldstein
2017-01-31  7:11       ` Amir Goldstein
2017-02-06 14:49         ` Amir Goldstein
2017-02-07 15:03           ` Miklos Szeredi
2017-01-23 12:32 ` [RFC][PATCH v2 2/3] ovl: properly implement sync_filesystem() Amir Goldstein
2017-01-23 12:32 ` [RFC][PATCH v2 3/3] ovl: support freeze/thaw super Amir Goldstein
2017-01-23 19:52 ` [RFC][PATCH v2 0/3] overlayfs: support freeze/thaw/syncfs Amir Goldstein

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=20170127163141.GG2584@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=amir73il@gmail.com \
    --cc=hch@lst.de \
    --cc=jack@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=mfasheh@versity.com \
    --cc=miklos@szeredi.hu \
    --cc=mtk.manpages@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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).