>From: Damian Hazen <dhazen@xxxxxxx>
>It looks like the vfs superblock structure is not being filled in
>completely until after the mount event is responded to. If
>dm_set_disp() is called before responding, it causes an oops in
>dm_handle_to_ip() when it attempts to get the dentry here:
>
>
> /* Now that the mutex is released, wait until we have access to the
> inode.
> */
>
> sb = fsrp->fr_sb;
> if (fidp->fid_len == 0) { /* filesystem handle */
>=> ip = sb->s_root->d_inode;
> igrab(ip);
>
>
>If you wait and call dm_set_disp() after responding, there's still a
>race with linvfs_fill_super() to get s_root set. Would it be possible
>to move up setting s_root to somewhere before dm_send_mount_event() is
>called? It's nice to be able to set disposition and event lists before
>turning the mount event loose to prevent anyone sneaking into the
>filesystem before we're ready.
This fixes the panic in my test. Would you try this please?
Dean
Index: 2.4.x-xfs-e/fs/dmapi/dmapi_register.c
===================================================================
--- 2.4.x-xfs-e.orig/fs/dmapi/dmapi_register.c 2005-02-18 12:30:10.000000000
-0600
+++ 2.4.x-xfs-e/fs/dmapi/dmapi_register.c 2005-03-07 10:12:14.000000000
-0600
@@ -507,6 +507,7 @@ dm_handle_to_ip(
struct super_block *sb;
struct inode *ip;
int filetype;
+ struct filesystem_dmapi_operations *dmapiops;
if ((fsrp = dm_find_fsreg_and_lock(&handlep->ha_fsid, &lc)) == NULL)
return(NULL);
@@ -549,17 +550,11 @@ dm_handle_to_ip(
*/
sb = fsrp->fr_sb;
- if (fidp->fid_len == 0) { /* filesystem handle */
- ip = sb->s_root->d_inode;
- igrab(ip);
- } else { /* file object handle */
- struct filesystem_dmapi_operations *dmapiops;
- error = -ENOSYS;
- dmapiops = dm_fsys_ops_by_fstype(sb->s_type);
- ASSERT(dmapiops);
- if (dmapiops->fh_to_inode)
- error = dmapiops->fh_to_inode(sb, &ip, (void*)fidp);
- }
+ error = -ENOSYS;
+ dmapiops = dm_fsys_ops_by_fstype(sb->s_type);
+ ASSERT(dmapiops);
+ if (dmapiops->fh_to_inode)
+ error = dmapiops->fh_to_inode(sb, &ip, (void*)fidp);
lc = mutex_spinlock(&fsrp->fr_lock);
Index: 2.4.x-xfs-e/fs/xfs/xfs_dmapi.c
===================================================================
--- 2.4.x-xfs-e.orig/fs/xfs/xfs_dmapi.c 2005-03-03 12:52:56.000000000 -0600
+++ 2.4.x-xfs-e/fs/xfs/xfs_dmapi.c 2005-03-07 10:17:51.000000000 -0600
@@ -3291,9 +3291,13 @@ xfs_dm_fh_to_inode(
*ip = NULL;
memcpy(&fid, dmfsfid, sizeof(*dmfsfid));
- ASSERT(fid.fid_len);
- VFS_VGET(vfsp, &vp, &fid, error);
- if (vp && (error == 0))
+ if (fid.fid_len) { /* file object handle */
+ VFS_VGET(vfsp, &vp, &fid, error);
+ }
+ else { /* filesystem handle */
+ VFS_ROOT(vfsp, &vp, error);
+ }
+ if(vp && (error == 0))
*ip = LINVFS_GET_IP(vp);
return -error; /* Return negative error to DMAPI */
}
|