Re: [PATCH v4 1/2] fs/super: function to prevent super re-use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Miklos,
Thanks for your response and apologies for my delayed reply.  Do I understand
correctly that to cover non-block devices I would need to add the same check
to test_keyed_super and to test_single_super? Am I missing any other place?
--Daniil

On Mon, Jul 18, 2022 at 7:51 PM Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
>
> On Wed, 1 Jun 2022 at 03:11, Daniil Lunev <dlunev@xxxxxxxxxxxx> wrote:
> >
> > From: Daniil Lunev <dlunev@xxxxxxxxxxxx>
> >
> > The function is to be called from filesystem-specific code to mark a
> > superblock to be ignored by superblock test and thus never re-used. The
> > function also unregisters bdi if the bdi is per-superblock to avoid
> > collision if a new superblock is created to represent the filesystem.
> > generic_shutdown_super() skips unregistering bdi for a retired
> > superlock as it assumes retire function has already done it.
> >
> > Signed-off-by: Daniil Lunev <dlunev@xxxxxxxxxxxx>
> > Signed-off-by: Daniil Lunev <dlunev@xxxxxxxxxx>
> > ---
> >
> > Changes in v4:
> > - Simplify condition according to Christoph Hellwig's comments.
> >
> > Changes in v3:
> > - Back to state tracking from v1
> > - Use s_iflag to mark superblocked ignored
> > - Only unregister private bdi in retire, without freeing
> >
> > Changes in v2:
> > - Remove super from list of superblocks instead of using a flag
> >
> >  fs/super.c         | 28 ++++++++++++++++++++++++++--
> >  include/linux/fs.h |  2 ++
> >  2 files changed, 28 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/super.c b/fs/super.c
> > index f1d4a193602d6..3fb9fc8d61160 100644
> > --- a/fs/super.c
> > +++ b/fs/super.c
> > @@ -422,6 +422,30 @@ bool trylock_super(struct super_block *sb)
> >         return false;
> >  }
> >
> > +/**
> > + *     retire_super    -       prevernts superblock from being reused
>
> s/prevernts/prevents/
>
> > + *     @sb: superblock to retire
> > + *
> > + *     The function marks superblock to be ignored in superblock test, which
> > + *     prevents it from being reused for any new mounts.
>
> This works for block supers and nothing else, at least as this patch
> stands.  That might be okay, but should at least be documented.
>
> Thanks,
> Miklos



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux