lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ovl: make private mounts longterm
> > > -     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.

\
 
 \ /
  Last update: 2020-05-22 19:03    [W:0.060 / U:6.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site