/* final actions when unmounting a file system */ static void sdcardfs_put_super(struct super_block *sb) { struct sdcardfs_sb_info *spd; struct super_block *s; spd = SDCARDFS_SB(sb); if (!spd) return; if(spd->obbpath_s) { kfree(spd->obbpath_s); path_put(&spd->obbpath); } /* decrement lower super references */ s = sdcardfs_lower_super(sb); sdcardfs_set_lower_super(sb, NULL); atomic_dec(&s->s_active); if(spd->pkgl_id) packagelist_destroy(spd->pkgl_id); kfree(spd); sb->s_fs_info = NULL; }
/* * Connect a sdcardfs inode dentry/inode with several lower ones. This is * the classic stackable file system "vnode interposition" action. * * @dentry: sdcardfs's dentry which interposes on lower one * @sb: sdcardfs's super_block * @lower_path: the lower path (caller does path_get/put) */ int sdcardfs_interpose(struct dentry *dentry, struct super_block *sb, struct path *lower_path) { int err = 0; struct inode *inode; struct inode *lower_inode; struct super_block *lower_sb; lower_inode = lower_path->dentry->d_inode; lower_sb = sdcardfs_lower_super(sb); /* check that the lower file system didn't cross a mount point */ if (lower_inode->i_sb != lower_sb) { err = -EXDEV; goto out; } /* * We allocate our new inode below by calling sdcardfs_iget, * which will initialize some of the new inode's fields */ /* inherit lower inode number for sdcardfs's inode */ inode = sdcardfs_iget(sb, lower_inode); if (IS_ERR(inode)) { err = PTR_ERR(inode); goto out; } d_add(dentry, inode); update_derived_permission(dentry); out: return err; }
/* * Used only in nfs, to kill any pending RPC tasks, so that subsequent * code can actually succeed and won't leave tasks that need handling. */ static void sdcardfs_umount_begin(struct super_block *sb) { struct super_block *lower_sb; lower_sb = sdcardfs_lower_super(sb); if (lower_sb && lower_sb->s_op && lower_sb->s_op->umount_begin) lower_sb->s_op->umount_begin(lower_sb); }