diff --git a/kmod/src/net.c b/kmod/src/net.c index 33d2da3c..14f1d4f3 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -1951,6 +1951,7 @@ int scoutfs_net_setup(struct super_block *sb) */ void scoutfs_net_destroy(struct super_block *sb) { + struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb); DECLARE_NET_INFO(sb, nti); struct sock_info *sinf; struct sock_info *pos; @@ -1987,5 +1988,6 @@ void scoutfs_net_destroy(struct super_block *sb) /* and free all resources */ free_sbuf_list(sb, &nti->to_send, -ESHUTDOWN); free_nti(nti); + sbi->net_info = NULL; } } diff --git a/kmod/src/super.c b/kmod/src/super.c index 0fe2ed52..bcf831fc 100644 --- a/kmod/src/super.c +++ b/kmod/src/super.c @@ -259,8 +259,12 @@ static void scoutfs_kill_sb(struct super_block *sb) { struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb); - /* make sure all dirty work is settled before killing the super */ - if (sbi) { + /* + * If we had successfully mounted then make sure dirty data + * writeback and compaction is done before we kill the block + * super and start tearing everything down. + */ + if (sb->s_root) { sync_filesystem(sb); scoutfs_lock_shutdown(sb); @@ -271,6 +275,7 @@ static void scoutfs_kill_sb(struct super_block *sb) if (sbi) { scoutfs_lock_destroy(sb); + scoutfs_net_destroy(sb); scoutfs_shutdown_trans(sb); scoutfs_data_destroy(sb); scoutfs_inode_destroy(sb);