btrfs: return EXDEV when linking from different subvolumes
authorMark Fasheh <mfasheh@suse.com>
Tue, 22 Mar 2011 17:20:26 +0000 (17:20 +0000)
committerroot <Chris Mason chris.mason@oracle.com>
Mon, 28 Mar 2011 09:37:42 +0000 (05:37 -0400)
btrfs_link returns EPERM if a cross-subvolume link is attempted.

However, in this case I believe EXDEV to be the more appropriate value.
>From the link(2) man page:

EXDEV  oldpath and newpath are not on the same mounted file system.  (Linux
       permits a file system to be mounted at multiple points, but link()
       does not work across different mount points, even if the same file
       system is mounted on both.)

This matters because an application may have different behaviors based on
return codes.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/inode.c

index 7a7a202b82ab33690534875481ac6e17f0c0701e..67fd6e9552d37174e6d5a223f36fed623bfa1f22 100644 (file)
@@ -4817,7 +4817,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
 
        /* do not allow sys_link's with other subvols of the same device */
        if (root->objectid != BTRFS_I(inode)->root->objectid)
-               return -EPERM;
+               return -EXDEV;
 
        btrfs_inc_nlink(inode);
        inode->i_ctime = CURRENT_TIME;
This page took 0.036724 seconds and 5 git commands to generate.