lkml.org 
[lkml]   [2006]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] ReiserFS: Make sure all dentries refs are released before calling kill_block_super() [try #2]
    Date

    Make sure all dentries refs are released before calling kill_block_super() so
    that the assumption that generic_shutdown_super() can completely destroy the
    dentry tree for there will be no external references holds true.

    What was being done in the put_super() superblock op, is now done in the
    kill_sb() filesystem op instead, prior to calling kill_block_super().


    Changes made in [try #2]:

    (*) reiserfs_kill_sb() now checks that the superblock FS info pointer is set
    before trying to dereference it.

    Signed-Off-By: David Howells <dhowells@redhat.com>
    ---

    fs/reiserfs/super.c | 31 ++++++++++++++++++++-----------
    1 files changed, 20 insertions(+), 11 deletions(-)

    diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
    index 5567328..c6e327a 100644
    --- a/fs/reiserfs/super.c
    +++ b/fs/reiserfs/super.c
    @@ -430,22 +430,31 @@ int remove_save_link(struct inode *inode
    return journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT);
    }

    +static void reiserfs_kill_sb(struct super_block *s)
    +{
    + if (REISERFS_SB(s)) {
    + if (REISERFS_SB(s)->xattr_root) {
    + d_invalidate(REISERFS_SB(s)->xattr_root);
    + dput(REISERFS_SB(s)->xattr_root);
    + REISERFS_SB(s)->xattr_root = NULL;
    + }
    +
    + if (REISERFS_SB(s)->priv_root) {
    + d_invalidate(REISERFS_SB(s)->priv_root);
    + dput(REISERFS_SB(s)->priv_root);
    + REISERFS_SB(s)->priv_root = NULL;
    + }
    + }
    +
    + kill_block_super(s);
    +}
    +
    static void reiserfs_put_super(struct super_block *s)
    {
    int i;
    struct reiserfs_transaction_handle th;
    th.t_trans_id = 0;

    - if (REISERFS_SB(s)->xattr_root) {
    - d_invalidate(REISERFS_SB(s)->xattr_root);
    - dput(REISERFS_SB(s)->xattr_root);
    - }
    -
    - if (REISERFS_SB(s)->priv_root) {
    - d_invalidate(REISERFS_SB(s)->priv_root);
    - dput(REISERFS_SB(s)->priv_root);
    - }
    -
    /* change file system state to current state if it was mounted with read-write permissions */
    if (!(s->s_flags & MS_RDONLY)) {
    if (!journal_begin(&th, s, 10)) {
    @@ -2300,7 +2309,7 @@ struct file_system_type reiserfs_fs_type
    .owner = THIS_MODULE,
    .name = "reiserfs",
    .get_sb = get_super_block,
    - .kill_sb = kill_block_super,
    + .kill_sb = reiserfs_kill_sb,
    .fs_flags = FS_REQUIRES_DEV,
    };

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2006-08-09 15:47    [W:4.237 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site