Bug 10668 - "unknown mode" error when copying a file over legacy mount
Summary: "unknown mode" error when copying a file over legacy mount
Status: CLOSED DUPLICATE of bug 10689
Alias: None
Product: File System
Classification: Unclassified
Component: v9fs (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Eric Van Hensbergen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-11 12:05 UTC by Eric Van Hensbergen
Modified: 2010-01-28 14:58 UTC (History)
0 users

See Also:
Kernel Version: 2.6.24
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Eric Van Hensbergen 2008-05-11 12:05:17 UTC
I can do a cat xyz > xyz in my contrib folder which creates a file named 'xyz'
but I get a permission denied when I try to copy some files over.

cp: cannot create regular file `./p9authsrv/auth/lib/getauthkey.c':
Permission denied

I am able to get over the above issue by doing a cat of that file and
do a ">". Obviously it would work only if I have a handful of files.
Comment 1 Eric Van Hensbergen 2008-05-11 12:07:01 UTC
This is due to a couple of factors:
a) append mode and exclusive mode mean something different for Linux than for Plan 9, but we still attempt to translate the mode bits even when in legacy mount mode (when mounting a plan 9 server)
b) the append bits are wrong and rejected by plan 9 severs.

This patch should fix it:
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -124,7 +124,7 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, 
        return res;
 }
 
-int v9fs_uflags2omode(int uflags)
+int v9fs_uflags2omode(struct v9fs_session_info *v9ses, int uflags)
 {
        int ret;
 
@@ -144,14 +144,17 @@ int v9fs_uflags2omode(int uflags)
                break;
        }
 
-       if (uflags & O_EXCL)
-               ret |= P9_OEXCL;
-
        if (uflags & O_TRUNC)
                ret |= P9_OTRUNC;
 
-       if (uflags & O_APPEND)
-               ret |= P9_OAPPEND;
+       /* these mean something different on Plan 9 than Linux */
+       if (v9fs_extended(v9ses)) {
+               if (uflags & O_EXCL)
+                       ret |= P9_OEXCL;
+
+               if (uflags & O_APPEND)
+                       ret |= P9_OAPPEND;
+       }


It will be submitted against 2.6.26-rc series.
Comment 2 Eric Van Hensbergen 2008-06-24 15:51:53 UTC

*** This bug has been marked as a duplicate of bug 10689 ***

Note You need to log in before you can comment on or make changes to this bug.