diff options
| -rw-r--r-- | fs/nfsd/nfs4state.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index eca8aaa450f1..c29b6ed2a0bb 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -1173,6 +1173,24 @@ static inline int deny_valid(u32 x) | |||
| 1173 | return x <= NFS4_SHARE_DENY_BOTH; | 1173 | return x <= NFS4_SHARE_DENY_BOTH; |
| 1174 | } | 1174 | } |
| 1175 | 1175 | ||
| 1176 | /* | ||
| 1177 | * We store the NONE, READ, WRITE, and BOTH bits separately in the | ||
| 1178 | * st_{access,deny}_bmap field of the stateid, in order to track not | ||
| 1179 | * only what share bits are currently in force, but also what | ||
| 1180 | * combinations of share bits previous opens have used. This allows us | ||
| 1181 | * to enforce the recommendation of rfc 3530 14.2.19 that the server | ||
| 1182 | * return an error if the client attempt to downgrade to a combination | ||
| 1183 | * of share bits not explicable by closing some of its previous opens. | ||
| 1184 | * | ||
| 1185 | * XXX: This enforcement is actually incomplete, since we don't keep | ||
| 1186 | * track of access/deny bit combinations; so, e.g., we allow: | ||
| 1187 | * | ||
| 1188 | * OPEN allow read, deny write | ||
| 1189 | * OPEN allow both, deny none | ||
| 1190 | * DOWNGRADE allow read, deny none | ||
| 1191 | * | ||
| 1192 | * which we should reject. | ||
| 1193 | */ | ||
| 1176 | static void | 1194 | static void |
| 1177 | set_access(unsigned int *access, unsigned long bmap) { | 1195 | set_access(unsigned int *access, unsigned long bmap) { |
| 1178 | int i; | 1196 | int i; |
