Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / nfs-cifs-intent-2.6.12.patch
1 Index: linux-2.6.12-rc6/fs/nfs/dir.c
2 ===================================================================
3 --- linux-2.6.12-rc6.orig/fs/nfs/dir.c  2005-06-14 14:22:14.585699648 +0200
4 +++ linux-2.6.12-rc6/fs/nfs/dir.c       2005-06-14 14:26:39.884524523 +0200
5 @@ -727,7 +727,7 @@
6                 return 0;
7         if (nd == NULL || nfs_lookup_check_intent(nd, LOOKUP_CREATE) == 0)
8                 return 0;
9 -       return (nd->intent.open.flags & O_EXCL) != 0;
10 +       return (nd->intent.it_flags & O_EXCL) != 0;
11  }
12  
13  static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
14 @@ -783,7 +783,7 @@
15         if (nd->flags & LOOKUP_DIRECTORY)
16                 return 0;
17         /* Are we trying to write to a read only partition? */
18 -       if (IS_RDONLY(dir) && (nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
19 +       if (IS_RDONLY(dir) && (nd->intent.it_flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
20                 return 0;
21         return 1;
22  }
23 @@ -805,7 +805,7 @@
24         dentry->d_op = NFS_PROTO(dir)->dentry_ops;
25  
26         /* Let vfs_create() deal with O_EXCL */
27 -       if (nd->intent.open.flags & O_EXCL)
28 +       if (nd->intent.it_flags & O_EXCL)
29                 goto no_entry;
30  
31         /* Open the file on the server */
32 @@ -817,7 +817,7 @@
33                 goto out;
34         }
35  
36 -       if (nd->intent.open.flags & O_CREAT) {
37 +       if (nd->intent.it_flags & O_CREAT) {
38                 nfs_begin_data_update(dir);
39                 inode = nfs4_atomic_open(dir, dentry, nd);
40                 nfs_end_data_update(dir);
41 @@ -833,7 +833,7 @@
42                                 break;
43                         /* This turned out not to be a regular file */
44                         case -ELOOP:
45 -                               if (!(nd->intent.open.flags & O_NOFOLLOW))
46 +                               if (!(nd->intent.it_flags & O_NOFOLLOW))
47                                         goto no_open;
48                         /* case -EISDIR: */
49                         /* case -EINVAL: */
50 @@ -874,7 +874,7 @@
51         /* NFS only supports OPEN on regular files */
52         if (!S_ISREG(inode->i_mode))
53                 goto no_open;
54 -       openflags = nd->intent.open.flags;
55 +       openflags = nd->intent.it_flags;
56         /* We cannot do exclusive creation on a positive dentry */
57         if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL))
58                 goto no_open;
59 @@ -1028,7 +1028,7 @@
60         attr.ia_valid = ATTR_MODE;
61  
62         if (nd && (nd->flags & LOOKUP_CREATE))
63 -               open_flags = nd->intent.open.flags;
64 +               open_flags = nd->intent.it_flags;
65  
66         lock_kernel();
67         nfs_begin_data_update(dir);
68 Index: linux-2.6.12-rc6/fs/nfs/nfs4proc.c
69 ===================================================================
70 --- linux-2.6.12-rc6.orig/fs/nfs/nfs4proc.c     2005-06-06 17:22:29.000000000 +0200
71 +++ linux-2.6.12-rc6/fs/nfs/nfs4proc.c  2005-06-14 14:30:18.499756220 +0200
72 @@ -877,19 +877,19 @@
73         struct nfs4_state *state;
74  
75         if (nd->flags & LOOKUP_CREATE) {
76 -               attr.ia_mode = nd->intent.open.create_mode;
77 +               attr.ia_mode = nd->intent.it_create_mode;
78                 attr.ia_valid = ATTR_MODE;
79                 if (!IS_POSIXACL(dir))
80                         attr.ia_mode &= ~current->fs->umask;
81         } else {
82                 attr.ia_valid = 0;
83 -               BUG_ON(nd->intent.open.flags & O_CREAT);
84 +               BUG_ON(nd->intent.it_flags & O_CREAT);
85         }
86  
87         cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0);
88         if (IS_ERR(cred))
89                 return (struct inode *)cred;
90 -       state = nfs4_do_open(dir, dentry, nd->intent.open.flags, &attr, cred);
91 +       state = nfs4_do_open(dir, dentry, nd->intent.it_flags, &attr, cred);
92         put_rpccred(cred);
93         if (IS_ERR(state))
94                 return (struct inode *)state;
95 Index: linux-2.6.12-rc6/fs/cifs/dir.c
96 ===================================================================
97 --- linux-2.6.12-rc6.orig/fs/cifs/dir.c 2005-06-06 17:22:29.000000000 +0200
98 +++ linux-2.6.12-rc6/fs/cifs/dir.c      2005-06-14 14:26:39.915774522 +0200
99 @@ -146,23 +146,23 @@
100         }
101  
102         if(nd) {
103 -               if ((nd->intent.open.flags & O_ACCMODE) == O_RDONLY)
104 +               if ((nd->intent.it_flags & O_ACCMODE) == O_RDONLY)
105                         desiredAccess = GENERIC_READ;
106 -               else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY) {
107 +               else if ((nd->intent.it_flags & O_ACCMODE) == O_WRONLY) {
108                         desiredAccess = GENERIC_WRITE;
109                         write_only = TRUE;
110 -               } else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) {
111 +               } else if ((nd->intent.it_flags & O_ACCMODE) == O_RDWR) {
112                         /* GENERIC_ALL is too much permission to request */
113                         /* can cause unnecessary access denied on create */
114                         /* desiredAccess = GENERIC_ALL; */
115                         desiredAccess = GENERIC_READ | GENERIC_WRITE;
116                 }
117  
118 -               if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
119 +               if((nd->intent.it_flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
120                         disposition = FILE_CREATE;
121 -               else if((nd->intent.open.flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
122 +               else if((nd->intent.it_flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
123                         disposition = FILE_OVERWRITE_IF;
124 -               else if((nd->intent.open.flags & O_CREAT) == O_CREAT)
125 +               else if((nd->intent.it_flags & O_CREAT) == O_CREAT)
126                         disposition = FILE_OPEN_IF;
127                 else {
128                         cFYI(1,("Create flag not set in create function"));