($INBOX_DIR/description missing)
 help / color / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <mszeredi@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ovl: make private mounts longterm
Date: Fri, 22 May 2020 20:02:37 +0300
Message-ID: <CAOQ4uxi80CFLgeTYbnHvD7GbY_01z0uywP1jF8gZe76_EZYiug@mail.gmail.com> (raw)
In-Reply-To: <CAOssrKcpQwYh39JpcNmV3JiuH2aPDJxgT5MADQ9cZMboPa9QaQ@mail.gmail.com>

> > > -     mntput(ofs->upper_mnt);
> > > -     for (i = 1; i < ofs->numlayer; i++) {
> > > -             iput(ofs->layers[i].trap);
> > > -             mntput(ofs->layers[i].mnt);
> > > +
> > > +     if (!ofs->layers) {
> > > +             /* Deal with partial setup */
> > > +             kern_unmount(ofs->upper_mnt);
> > > +     } else {
> > > +             /* Hack!  Reuse ofs->layers as a mounts array */
> > > +             struct vfsmount **mounts = (struct vfsmount **) ofs->layers;
> > > +
> > > +             for (i = 0; i < ofs->numlayer; i++) {
> > > +                     iput(ofs->layers[i].trap);
> > > +                     mounts[i] = ofs->layers[i].mnt;
> > > +             }
> > > +             kern_unmount_many(mounts, ofs->numlayer);
> > > +             kfree(ofs->layers);
> >
> > That's _way_ too subtle.  AFAICS, you rely upon ->upper_mnt == ->layers[0].mnt,
> > ->layers[0].trap == NULL, without even mentioning that.  And the hack you do
> > mention...  Yecchhh...  How many layers are possible, again?
>
> 500, mounts array would fit inside a page and a page can be allocated
> with __GFP_NOFAIL. But why bother?  It's not all that bad, is it?

FWIW, it seems fine to me.
We can transfer the reference from upperdir_trap to layers[0].trap
when initializing layers[0] for the sake of clarity.

Thanks,
Amir.

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  8:57 Miklos Szeredi
2020-05-22 16:08 ` Al Viro
2020-05-22 16:32   ` Miklos Szeredi
2020-05-22 17:02     ` Amir Goldstein [this message]
2020-05-22 18:53       ` Miklos Szeredi
2020-05-22 19:56         ` Al Viro
2020-05-23  4:07           ` 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=CAOQ4uxi80CFLgeTYbnHvD7GbY_01z0uywP1jF8gZe76_EZYiug@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=mszeredi@redhat.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

($INBOX_DIR/description missing)

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-unionfs/0 linux-unionfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-unionfs linux-unionfs/ https://lore.kernel.org/linux-unionfs \
		linux-unionfs@vger.kernel.org
	public-inbox-index linux-unionfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-unionfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git