From: "Namjae Jeon" <namjae.jeon@samsung.com>
To: "'Al Viro'" <viro@zeniv.linux.org.uk>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<gregkh@linuxfoundation.org>, <valdis.kletnieks@vt.edu>,
<hch@lst.de>, <sj1557.seo@samsung.com>, <pali.rohar@gmail.com>,
<arnd@arndb.de>, "'Namjae Jeon'" <linkinjeon@gmail.com>
Subject: RE: [PATCH v12 02/13] exfat: add super block operations
Date: Tue, 21 Jan 2020 11:34:40 +0900 [thread overview]
Message-ID: <005201d5d003$55325960$ff970c20$@samsung.com> (raw)
In-Reply-To: <20200121014924.GI8904@ZenIV.linux.org.uk>
> > +static void exfat_put_super(struct super_block *sb) {
> > + struct exfat_sb_info *sbi = EXFAT_SB(sb);
> > +
> > + mutex_lock(&sbi->s_lock);
> > + if (test_and_clear_bit(EXFAT_SB_DIRTY, &sbi->s_state))
> > + sync_blockdev(sb->s_bdev);
> > + exfat_set_vol_flags(sb, VOL_CLEAN);
> > + exfat_free_upcase_table(sb);
> > + exfat_free_bitmap(sb);
> > + mutex_unlock(&sbi->s_lock);
> > +
> > + if (sbi->nls_io) {
> > + unload_nls(sbi->nls_io);
> > + sbi->nls_io = NULL;
> > + }
> > + exfat_free_iocharset(sbi);
> > + sb->s_fs_info = NULL;
> > + kfree(sbi);
> > +}
>
> You need to RCU-delay freeing sbi and zeroing ->nls_io. *Everything* used
> by ->d_compare() and ->d_hash() needs that treatment. RCU-mode pathwalk
> can stray into a filesystem that has already been lazy-umounted and is
> just one close() away from shutdown. It's OK, as long as you make sure
> that all structures used in methods that could be called in RCU mode (-
> >d_compare(), ->d_hash(), rcu-case ->d_revalidate(), rcu-case -
> >permission()) have destruction RCU-delayed. Look at what VFAT is doing;
> that's precisely the reason for that delayed_free() thing in there.
Okay.
>
> > +static void exfat_destroy_inode(struct inode *inode) {
> > + kmem_cache_free(exfat_inode_cachep, EXFAT_I(inode)); }
>
> No. Again, that MUST be RCU-delayed; either put an explicit
> call_rcu() here, or leave as-is, but make that ->free_inode().
Okay.
>
> > +static void __exit exit_exfat_fs(void) {
> > + kmem_cache_destroy(exfat_inode_cachep);
> > + unregister_filesystem(&exfat_fs_type);
>
> ... and add rcu_barrier() here.
Okay, I will fix them on next version.
Thanks for review!!
>
> > + exfat_cache_shutdown();
next prev parent reply other threads:[~2020-01-21 2:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 12:44 [PATCH v12 00/13] add the latest exfat driver Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 01/13] exfat: add in-memory and on-disk structures and headers Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 02/13] exfat: add super block operations Namjae Jeon
2020-01-21 1:49 ` Al Viro
2020-01-21 2:34 ` Namjae Jeon [this message]
2020-01-20 12:44 ` [PATCH v12 03/13] exfat: add inode operations Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 04/13] exfat: add directory operations Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 05/13] exfat: add file operations Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 06/13] exfat: add fat entry operations Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 07/13] exfat: add bitmap operations Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 08/13] exfat: add exfat cache Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 09/13] exfat: add misc operations Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 10/13] exfat: add nls operations Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 11/13] exfat: add Kconfig and Makefile Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 12/13] MAINTAINERS: add exfat filesystem Namjae Jeon
2020-01-20 12:44 ` [PATCH v12 13/13] staging: exfat: make staging/exfat and fs/exfat mutually exclusive Namjae Jeon
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='005201d5d003$55325960$ff970c20$@samsung.com' \
--to=namjae.jeon@samsung.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=linkinjeon@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=sj1557.seo@samsung.com \
--cc=valdis.kletnieks@vt.edu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).