patch-2.4.26 linux-2.4.26/fs/xfs/linux/xfs_ioctl.c
Next file: linux-2.4.26/fs/xfs/linux/xfs_iops.c
Previous file: linux-2.4.26/fs/xfs/linux/xfs_globals.c
Back to the patch index
Back to the overall index
- Lines: 155
- Date:
2004-04-14 06:05:40.000000000 -0700
- Orig file:
linux-2.4.25/fs/xfs/linux/xfs_ioctl.c
- Orig date:
2004-02-18 05:36:31.000000000 -0800
diff -urN linux-2.4.25/fs/xfs/linux/xfs_ioctl.c linux-2.4.26/fs/xfs/linux/xfs_ioctl.c
@@ -310,7 +310,6 @@
struct dentry *dentry;
vnode_t *vp;
xfs_fsop_handlereq_t hreq;
- struct list_head *lp;
error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
sizeof(xfs_fsop_handlereq_t),
@@ -356,32 +355,13 @@
return new_fd;
}
- /* Now to find a dentry. If possible, get a well-connected one. */
- spin_lock(&dcache_lock);
- for (lp = inode->i_dentry.next; lp != &inode->i_dentry ; lp=lp->next) {
- dentry = list_entry(lp, struct dentry, d_alias);
- if (! (dentry->d_flags & DCACHE_NFSD_DISCONNECTED)) {
- dget_locked(dentry);
- dentry->d_vfs_flags |= DCACHE_REFERENCED;
- spin_unlock(&dcache_lock);
- iput(inode);
- goto found;
- }
- }
- spin_unlock(&dcache_lock);
-
- /* ELSE didn't find dentry. Create anonymous dcache entry. */
- dentry = d_alloc_root(inode);
+ dentry = d_alloc_anon(inode);
if (dentry == NULL) {
iput(inode);
put_unused_fd(new_fd);
return -XFS_ERROR(ENOMEM);
}
- /* Keep nfsd happy. */
- dentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
-
- found:
/* Ensure umount returns EBUSY on umounts while this file is open. */
mntget(parfilp->f_vfsmnt);
@@ -721,9 +701,7 @@
error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate,
NULL);
- if (error)
- return -error;
- return 0;
+ return -error;
}
case XFS_IOC_GETBMAP:
@@ -755,9 +733,7 @@
case XFS_IOC_SWAPEXT: {
error = xfs_swapext((struct xfs_swapext *)arg);
- if (error)
- return -error;
- return 0;
+ return -error;
}
case XFS_IOC_FSCOUNTS: {
@@ -785,6 +761,8 @@
/* input parameter is passed in resblks field of structure */
in = inout.resblks;
error = xfs_reserve_blocks(mp, &in, &inout);
+ if (error)
+ return -error;
if (copy_to_user((char *)arg, &inout, sizeof(inout)))
return -XFS_ERROR(EFAULT);
@@ -817,9 +795,7 @@
return -XFS_ERROR(EFAULT);
error = xfs_growfs_data(mp, &in);
- if (error)
- return -error;
- return 0;
+ return -error;
}
case XFS_IOC_FSGROWFSLOG: {
@@ -832,9 +808,7 @@
return -XFS_ERROR(EFAULT);
error = xfs_growfs_log(mp, &in);
- if (error)
- return -error;
- return 0;
+ return -error;
}
case XFS_IOC_FSGROWFSRT: {
@@ -847,9 +821,7 @@
return -XFS_ERROR(EFAULT);
error = xfs_growfs_rt(mp, &in);
- if (error)
- return -error;
- return 0;
+ return -error;
}
case XFS_IOC_FREEZE:
@@ -864,19 +836,36 @@
xfs_fs_thaw(mp);
return 0;
+ case XFS_IOC_GOINGDOWN: {
+ __uint32_t in;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
+ if (get_user(in, (__uint32_t *)arg))
+ return -XFS_ERROR(EFAULT);
+
+ error = xfs_fs_goingdown(mp, in);
+ return -error;
+ }
+
case XFS_IOC_ERROR_INJECTION: {
xfs_error_injection_t in;
+ if (!capable(CAP_SYS_ADMIN))
+ return EPERM;
+
if (copy_from_user(&in, (char *)arg, sizeof(in)))
return -XFS_ERROR(EFAULT);
error = xfs_errortag_add(in.errtag, mp);
- if (error)
- return -error;
- return 0;
+ return -error;
}
case XFS_IOC_ERROR_CLEARALL:
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
error = xfs_errortag_clearall(mp);
return -error;
@@ -901,7 +890,7 @@
if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND))
return -XFS_ERROR(EPERM);
- if (filp->f_flags & O_RDONLY)
+ if (!(filp->f_flags & FMODE_WRITE))
return -XFS_ERROR(EBADF);
if (vp->v_type != VREG)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)