[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170731182352.GE4477@magnolia>
Date: Mon, 31 Jul 2017 11:23:52 -0700
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: Colin Walters <walters@...bum.org>
Cc: Dan Williams <dan.j.williams@...el.com>, Jan Kara <jack@...e.cz>,
linux-nvdimm@...ts.01.org, Dave Chinner <david@...morbit.com>,
linux-kernel@...r.kernel.org, linux-xfs@...r.kernel.org,
Jeff Moyer <jmoyer@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andy Lutomirski <luto@...nel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Ross Zwisler <ross.zwisler@...ux.intel.com>,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 1/3] fs, xfs: introduce S_IOMAP_IMMUTABLE
On Mon, Jul 31, 2017 at 01:42:13PM -0400, Colin Walters wrote:
>
>
> On Mon, Jul 31, 2017, at 12:32 PM, Colin Walters wrote:
> > On Mon, Jul 31, 2017, at 12:29 PM, Dan Williams wrote:
> > >
> > > How is S_CONTENTS_IMMUTABLE different than S_IMMUTABLE?
> >
> > We still want the ability to make hardlinks.
>
> Also of course, symmetrically, to unlink. If we used S_IMMUTABLE for /etc/sudoers,
> it'd still be racy since one would have to transiently remove the flag in order
> to replace it with a new version.
>
> Related to this topic is the fact that S_IMMUTABLE is itself mutable; I
> think once S_IMMUTABLE_CONTENTS is set, it would not be able to made
> mutable again.
>
> Also I just remembered that since then memfd_create() and more notably
> fcntl(F_ADD_SEALS) landed - in fact it already has flags for what we want
> here AFAICS. Your S_IOMAP_IMMUTABLE is fcntl(F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_GROW)
I don't think F_SEAL_{SHRINK,GROW} prevents reflinking or CoW of file data,
which are two things that cannot happen under S_IOMAP_IMMUTABLE that
aren't size changes. From the implementation it looks like shrink and
grow are only supposed to disallow changes to i_size, not i_blocks (or
the file block map).
Then again, I suppose F_SEAL_* only work on shmem, so maybe it simply
isn't defined for any other filesystem...? e.g. it doesn't prohibit
reflink, but the only fs implementing seals doesn't support reflink.
<shrug>
Seals cannot be removed, which is too strict for the S_IOMAP_IMMUTABLE
user cases being presented.
> and mine just adds in F_SEAL_WRITE. I think there was some discussion
> of the seals for persistent files when memfd_create() landed, but I can't
> find it offhand.
--D
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists