Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[pandora-kernel.git] / fs / xfs / linux-2.6 / xfs_ioctl.c
index 48799ba..281cbd5 100644 (file)
@@ -256,6 +256,7 @@ xfs_open_by_handle(
        struct file             *parfilp,
        struct inode            *parinode)
 {
+       const struct cred       *cred = current_cred();
        int                     error;
        int                     new_fd;
        int                     permflag;
@@ -311,18 +312,17 @@ xfs_open_by_handle(
                return new_fd;
        }
 
-       dentry = d_alloc_anon(inode);
-       if (dentry == NULL) {
-               iput(inode);
+       dentry = d_obtain_alias(inode);
+       if (IS_ERR(dentry)) {
                put_unused_fd(new_fd);
-               return -XFS_ERROR(ENOMEM);
+               return PTR_ERR(dentry);
        }
 
        /* Ensure umount returns EBUSY on umounts while this file is open. */
        mntget(parfilp->f_path.mnt);
 
        /* Create file pointer. */
-       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags);
+       filp = dentry_open(dentry, parfilp->f_path.mnt, hreq.oflags, cred);
        if (IS_ERR(filp)) {
                put_unused_fd(new_fd);
                return -XFS_ERROR(-PTR_ERR(filp));
@@ -1008,7 +1008,7 @@ xfs_ioctl_setattr(
         * to the file owner ID, except in cases where the
         * CAP_FSETID capability is applicable.
         */
-       if (current->fsuid != ip->i_d.di_uid && !capable(CAP_FOWNER)) {
+       if (current_fsuid() != ip->i_d.di_uid && !capable(CAP_FOWNER)) {
                code = XFS_ERROR(EPERM);
                goto error_return;
        }