All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/2] vfs: introduce inode 'inuse' lock
Date: Wed, 31 May 2017 16:54:57 +0300	[thread overview]
Message-ID: <CAOQ4uxi=0w2JmBJqoRGZ9iqete2rhCQv0i+qYyk9=rXvEX+s3Q@mail.gmail.com> (raw)
In-Reply-To: <CAJfpegugzuJUszWV4CEDC92pCcU1tv1t=kZX0O0Uk_Uhjyoi1A@mail.gmail.com>

On Wed, May 31, 2017 at 1:09 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
> On Tue, May 23, 2017 at 11:50 AM, Amir Goldstein <amir73il@gmail.com> wrote:
>> Added an i_state flag I_INUSE and helpers to set/clear/test the bit.
>>
>> The 'inuse' lock is an 'advisory' inode lock, which also provides
>> may_delete() protection, so can be used to extend exclusive create
>> protection beyond parent->i_mutex lock among cooperating users.
>>
>> This is going to be used by overlayfs to get exclusive ownership
>> on upper and work dirs among overlayfs mounts.
>
> Not sure I like the delete protection.  Any modification of workdir or
> layers while mounted might cause inconsistencies or errors in the
> overlay.  So why single out deletion of base directories?
>

There are a few reasons why 'inuse' inode should not be deleted,
regardless of whether delete protection is needed by overlayfs or not
(I think we don't need it).

1. setting INUSE on a  FREEING|WILL_FREE inode is not allowed
so preventing delete on INUSE makes the possible states fewer and
easier to manage.

2. With latest patchset I also implemented wait_on_inode_inuse()
https://github.com/amir73il/linux/blob/ovl-dir-lock/fs/inode.c#L2175
which is later used by to copy up code for index hardlink.
By preventing delete, I can isolate I_INUSE waiters from I_NEW waiters
and don't need to deal with INUSE waiters and inode delete.

3. Backwards justification: the man page for unlink(2) and rmdir(2)
already explain EBUSY in a generic way:
"pathname cannot be unlinked because it is being used by the system ..."
"pathname is currently in use by the system or ..."

So you may think of the new INUSE flag as a declaration by any
module in the system to make the inode qualify for "in use by the system".

Did any of the arguments above convince you to leave delete protection?
Because if I leave delete protection in v2, I agree the reason should
be better documented.

Amir.

  reply	other threads:[~2017-05-31 13:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23  9:50 [PATCH 0/2] overlayfs multiple mount protection Amir Goldstein
2017-05-23  9:50 ` [PATCH 1/2] vfs: introduce inode 'inuse' lock Amir Goldstein
2017-05-31 10:09   ` Miklos Szeredi
2017-05-31 13:54     ` Amir Goldstein [this message]
2017-05-31 14:30       ` Miklos Szeredi
2017-05-31 15:16         ` Amir Goldstein
2017-05-23  9:50 ` [PATCH 2/2] ovl: get exclusive ownership on upper/work dirs Amir Goldstein
2017-05-31 10:18   ` Miklos Szeredi
2017-05-31 12:47     ` Amir Goldstein
2017-05-31 13:05       ` Amir Goldstein
2017-05-31 13:24         ` Miklos Szeredi

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='CAOQ4uxi=0w2JmBJqoRGZ9iqete2rhCQv0i+qYyk9=rXvEX+s3Q@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.