diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 11:20:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-24 11:20:39 -0400 |
commit | dc87c55120b0a5b0c4d731183f8bb348981aba65 (patch) | |
tree | c5a4f94ed6cc1678072c125f2cae08f04ce4f2b8 | |
parent | 5818fcc8bd1b27af4d40b8357b91a56cc3fae6a4 (diff) | |
parent | 4be34b9d69c97211ff4eb00d79078f3c1593804d (diff) |
Merge branch 'for-2.6.39' of git://linux-nfs.org/~bfields/linux
* 'for-2.6.39' of git://linux-nfs.org/~bfields/linux:
SUNRPC: Remove resource leak in svc_rdma_send_error()
nfsd: wrong index used in inner loop
nfsd4: fix comment and remove unused nfsd4_file fields
nfs41: make sure nfs server return right ca_maxresponsesize_cached
nfsd: fix compile error
svcrpc: fix bad argument in unix_domain_find
nfsd4: fix struct file leak
nfsd4: minor nfs4state.c reshuffling
svcrpc: fix rare race on unix_domain creation
nfsd41: modify the members value of nfsd4_op_flags
nfsd: add proc file listing kernel's gss_krb5 enctypes
gss:krb5 only include enctype numbers in gm_upcall_enctypes
NFSD, VFS: Remove dead code in nfsd_rename()
nfsd: kill unused macro definition
locks: use assign_type()
-rw-r--r-- | fs/locks.c | 12 | ||||
-rw-r--r-- | fs/nfsd/export.c | 1 | ||||
-rw-r--r-- | fs/nfsd/nfs4idmap.c | 1 | ||||
-rw-r--r-- | fs/nfsd/nfs4proc.c | 4 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 160 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 5 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 35 | ||||
-rw-r--r-- | fs/nfsd/state.h | 12 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 18 |
10 files changed, 135 insertions, 115 deletions
diff --git a/fs/locks.c b/fs/locks.c index 822c3d1843a..0a4f50dfadf 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -414,17 +414,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, | |||
414 | fl->fl_ops = NULL; | 414 | fl->fl_ops = NULL; |
415 | fl->fl_lmops = NULL; | 415 | fl->fl_lmops = NULL; |
416 | 416 | ||
417 | switch (l->l_type) { | 417 | return assign_type(fl, l->l_type); |
418 | case F_RDLCK: | ||
419 | case F_WRLCK: | ||
420 | case F_UNLCK: | ||
421 | fl->fl_type = l->l_type; | ||
422 | break; | ||
423 | default: | ||
424 | return -EINVAL; | ||
425 | } | ||
426 | |||
427 | return (0); | ||
428 | } | 418 | } |
429 | #endif | 419 | #endif |
430 | 420 | ||
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 8b31e5f8795..ad000aeb21a 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -299,7 +299,6 @@ svc_expkey_update(struct svc_expkey *new, struct svc_expkey *old) | |||
299 | 299 | ||
300 | #define EXPORT_HASHBITS 8 | 300 | #define EXPORT_HASHBITS 8 |
301 | #define EXPORT_HASHMAX (1<< EXPORT_HASHBITS) | 301 | #define EXPORT_HASHMAX (1<< EXPORT_HASHBITS) |
302 | #define EXPORT_HASHMASK (EXPORT_HASHMAX -1) | ||
303 | 302 | ||
304 | static struct cache_head *export_table[EXPORT_HASHMAX]; | 303 | static struct cache_head *export_table[EXPORT_HASHMAX]; |
305 | 304 | ||
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index 6d2c397d458..55780a22fdb 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -63,7 +63,6 @@ struct ent { | |||
63 | 63 | ||
64 | #define ENT_HASHBITS 8 | 64 | #define ENT_HASHBITS 8 |
65 | #define ENT_HASHMAX (1 << ENT_HASHBITS) | 65 | #define ENT_HASHMAX (1 << ENT_HASHBITS) |
66 | #define ENT_HASHMASK (ENT_HASHMAX - 1) | ||
67 | 66 | ||
68 | static void | 67 | static void |
69 | ent_init(struct cache_head *cnew, struct cache_head *citm) | 68 | ent_init(struct cache_head *cnew, struct cache_head *citm) |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index db52546143d..5fcb1396a7e 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -984,8 +984,8 @@ typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *, | |||
984 | void *); | 984 | void *); |
985 | enum nfsd4_op_flags { | 985 | enum nfsd4_op_flags { |
986 | ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */ | 986 | ALLOWED_WITHOUT_FH = 1 << 0, /* No current filehandle required */ |
987 | ALLOWED_ON_ABSENT_FS = 2 << 0, /* ops processed on absent fs */ | 987 | ALLOWED_ON_ABSENT_FS = 1 << 1, /* ops processed on absent fs */ |
988 | ALLOWED_AS_FIRST_OP = 3 << 0, /* ops reqired first in compound */ | 988 | ALLOWED_AS_FIRST_OP = 1 << 2, /* ops reqired first in compound */ |
989 | }; | 989 | }; |
990 | 990 | ||
991 | struct nfsd4_operation { | 991 | struct nfsd4_operation { |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 7b566ec14e1..fbde6f79922 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -148,7 +148,7 @@ static struct list_head ownerstr_hashtbl[OWNER_HASH_SIZE]; | |||
148 | /* hash table for nfs4_file */ | 148 | /* hash table for nfs4_file */ |
149 | #define FILE_HASH_BITS 8 | 149 | #define FILE_HASH_BITS 8 |
150 | #define FILE_HASH_SIZE (1 << FILE_HASH_BITS) | 150 | #define FILE_HASH_SIZE (1 << FILE_HASH_BITS) |
151 | #define FILE_HASH_MASK (FILE_HASH_SIZE - 1) | 151 | |
152 | /* hash table for (open)nfs4_stateid */ | 152 | /* hash table for (open)nfs4_stateid */ |
153 | #define STATEID_HASH_BITS 10 | 153 | #define STATEID_HASH_BITS 10 |
154 | #define STATEID_HASH_SIZE (1 << STATEID_HASH_BITS) | 154 | #define STATEID_HASH_SIZE (1 << STATEID_HASH_BITS) |
@@ -316,64 +316,6 @@ static struct list_head unconf_id_hashtbl[CLIENT_HASH_SIZE]; | |||
316 | static struct list_head client_lru; | 316 | static struct list_head client_lru; |
317 | static struct list_head close_lru; | 317 | static struct list_head close_lru; |
318 | 318 | ||
319 | static void unhash_generic_stateid(struct nfs4_stateid *stp) | ||
320 | { | ||
321 | list_del(&stp->st_hash); | ||
322 | list_del(&stp->st_perfile); | ||
323 | list_del(&stp->st_perstateowner); | ||
324 | } | ||
325 | |||
326 | static void free_generic_stateid(struct nfs4_stateid *stp) | ||
327 | { | ||
328 | put_nfs4_file(stp->st_file); | ||
329 | kmem_cache_free(stateid_slab, stp); | ||
330 | } | ||
331 | |||
332 | static void release_lock_stateid(struct nfs4_stateid *stp) | ||
333 | { | ||
334 | struct file *file; | ||
335 | |||
336 | unhash_generic_stateid(stp); | ||
337 | file = find_any_file(stp->st_file); | ||
338 | if (file) | ||
339 | locks_remove_posix(file, (fl_owner_t)stp->st_stateowner); | ||
340 | free_generic_stateid(stp); | ||
341 | } | ||
342 | |||
343 | static void unhash_lockowner(struct nfs4_stateowner *sop) | ||
344 | { | ||
345 | struct nfs4_stateid *stp; | ||
346 | |||
347 | list_del(&sop->so_idhash); | ||
348 | list_del(&sop->so_strhash); | ||
349 | list_del(&sop->so_perstateid); | ||
350 | while (!list_empty(&sop->so_stateids)) { | ||
351 | stp = list_first_entry(&sop->so_stateids, | ||
352 | struct nfs4_stateid, st_perstateowner); | ||
353 | release_lock_stateid(stp); | ||
354 | } | ||
355 | } | ||
356 | |||
357 | static void release_lockowner(struct nfs4_stateowner *sop) | ||
358 | { | ||
359 | unhash_lockowner(sop); | ||
360 | nfs4_put_stateowner(sop); | ||
361 | } | ||
362 | |||
363 | static void | ||
364 | release_stateid_lockowners(struct nfs4_stateid *open_stp) | ||
365 | { | ||
366 | struct nfs4_stateowner *lock_sop; | ||
367 | |||
368 | while (!list_empty(&open_stp->st_lockowners)) { | ||
369 | lock_sop = list_entry(open_stp->st_lockowners.next, | ||
370 | struct nfs4_stateowner, so_perstateid); | ||
371 | /* list_del(&open_stp->st_lockowners); */ | ||
372 | BUG_ON(lock_sop->so_is_open_owner); | ||
373 | release_lockowner(lock_sop); | ||
374 | } | ||
375 | } | ||
376 | |||
377 | /* | 319 | /* |
378 | * We store the NONE, READ, WRITE, and BOTH bits separately in the | 320 | * We store the NONE, READ, WRITE, and BOTH bits separately in the |
379 | * st_{access,deny}_bmap field of the stateid, in order to track not | 321 | * st_{access,deny}_bmap field of the stateid, in order to track not |
@@ -446,13 +388,71 @@ static int nfs4_access_bmap_to_omode(struct nfs4_stateid *stp) | |||
446 | return nfs4_access_to_omode(access); | 388 | return nfs4_access_to_omode(access); |
447 | } | 389 | } |
448 | 390 | ||
449 | static void release_open_stateid(struct nfs4_stateid *stp) | 391 | static void unhash_generic_stateid(struct nfs4_stateid *stp) |
392 | { | ||
393 | list_del(&stp->st_hash); | ||
394 | list_del(&stp->st_perfile); | ||
395 | list_del(&stp->st_perstateowner); | ||
396 | } | ||
397 | |||
398 | static void free_generic_stateid(struct nfs4_stateid *stp) | ||
450 | { | 399 | { |
451 | int oflag = nfs4_access_bmap_to_omode(stp); | 400 | int oflag = nfs4_access_bmap_to_omode(stp); |
452 | 401 | ||
402 | nfs4_file_put_access(stp->st_file, oflag); | ||
403 | put_nfs4_file(stp->st_file); | ||
404 | kmem_cache_free(stateid_slab, stp); | ||
405 | } | ||
406 | |||
407 | static void release_lock_stateid(struct nfs4_stateid *stp) | ||
408 | { | ||
409 | struct file *file; | ||
410 | |||
411 | unhash_generic_stateid(stp); | ||
412 | file = find_any_file(stp->st_file); | ||
413 | if (file) | ||
414 | locks_remove_posix(file, (fl_owner_t)stp->st_stateowner); | ||
415 | free_generic_stateid(stp); | ||
416 | } | ||
417 | |||
418 | static void unhash_lockowner(struct nfs4_stateowner *sop) | ||
419 | { | ||
420 | struct nfs4_stateid *stp; | ||
421 | |||
422 | list_del(&sop->so_idhash); | ||
423 | list_del(&sop->so_strhash); | ||
424 | list_del(&sop->so_perstateid); | ||
425 | while (!list_empty(&sop->so_stateids)) { | ||
426 | stp = list_first_entry(&sop->so_stateids, | ||
427 | struct nfs4_stateid, st_perstateowner); | ||
428 | release_lock_stateid(stp); | ||
429 | } | ||
430 | } | ||
431 | |||
432 | static void release_lockowner(struct nfs4_stateowner *sop) | ||
433 | { | ||
434 | unhash_lockowner(sop); | ||
435 | nfs4_put_stateowner(sop); | ||
436 | } | ||
437 | |||
438 | static void | ||
439 | release_stateid_lockowners(struct nfs4_stateid *open_stp) | ||
440 | { | ||
441 | struct nfs4_stateowner *lock_sop; | ||
442 | |||
443 | while (!list_empty(&open_stp->st_lockowners)) { | ||
444 | lock_sop = list_entry(open_stp->st_lockowners.next, | ||
445 | struct nfs4_stateowner, so_perstateid); | ||
446 | /* list_del(&open_stp->st_lockowners); */ | ||
447 | BUG_ON(lock_sop->so_is_open_owner); | ||
448 | release_lockowner(lock_sop); | ||
449 | } | ||
450 | } | ||
451 | |||
452 | static void release_open_stateid(struct nfs4_stateid *stp) | ||
453 | { | ||
453 | unhash_generic_stateid(stp); | 454 | unhash_generic_stateid(stp); |
454 | release_stateid_lockowners(stp); | 455 | release_stateid_lockowners(stp); |
455 | nfs4_file_put_access(stp->st_file, oflag); | ||
456 | free_generic_stateid(stp); | 456 | free_generic_stateid(stp); |
457 | } | 457 | } |
458 | 458 | ||
@@ -608,7 +608,8 @@ static void init_forechannel_attrs(struct nfsd4_channel_attrs *new, struct nfsd4 | |||
608 | u32 maxrpc = nfsd_serv->sv_max_mesg; | 608 | u32 maxrpc = nfsd_serv->sv_max_mesg; |
609 | 609 | ||
610 | new->maxreqs = numslots; | 610 | new->maxreqs = numslots; |
611 | new->maxresp_cached = slotsize + NFSD_MIN_HDR_SEQ_SZ; | 611 | new->maxresp_cached = min_t(u32, req->maxresp_cached, |
612 | slotsize + NFSD_MIN_HDR_SEQ_SZ); | ||
612 | new->maxreq_sz = min_t(u32, req->maxreq_sz, maxrpc); | 613 | new->maxreq_sz = min_t(u32, req->maxreq_sz, maxrpc); |
613 | new->maxresp_sz = min_t(u32, req->maxresp_sz, maxrpc); | 614 | new->maxresp_sz = min_t(u32, req->maxresp_sz, maxrpc); |
614 | new->maxops = min_t(u32, req->maxops, NFSD_MAX_OPS_PER_COMPOUND); | 615 | new->maxops = min_t(u32, req->maxops, NFSD_MAX_OPS_PER_COMPOUND); |
@@ -3735,6 +3736,7 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc | |||
3735 | stp->st_stateid.si_stateownerid = sop->so_id; | 3736 | stp->st_stateid.si_stateownerid = sop->so_id; |
3736 | stp->st_stateid.si_fileid = fp->fi_id; | 3737 | stp->st_stateid.si_fileid = fp->fi_id; |
3737 | stp->st_stateid.si_generation = 0; | 3738 | stp->st_stateid.si_generation = 0; |
3739 | stp->st_access_bmap = 0; | ||
3738 | stp->st_deny_bmap = open_stp->st_deny_bmap; | 3740 | stp->st_deny_bmap = open_stp->st_deny_bmap; |
3739 | stp->st_openstp = open_stp; | 3741 | stp->st_openstp = open_stp; |
3740 | 3742 | ||
@@ -3749,6 +3751,17 @@ check_lock_length(u64 offset, u64 length) | |||
3749 | LOFF_OVERFLOW(offset, length))); | 3751 | LOFF_OVERFLOW(offset, length))); |
3750 | } | 3752 | } |
3751 | 3753 | ||
3754 | static void get_lock_access(struct nfs4_stateid *lock_stp, u32 access) | ||
3755 | { | ||
3756 | struct nfs4_file *fp = lock_stp->st_file; | ||
3757 | int oflag = nfs4_access_to_omode(access); | ||
3758 | |||
3759 | if (test_bit(access, &lock_stp->st_access_bmap)) | ||
3760 | return; | ||
3761 | nfs4_file_get_access(fp, oflag); | ||
3762 | __set_bit(access, &lock_stp->st_access_bmap); | ||
3763 | } | ||
3764 | |||
3752 | /* | 3765 | /* |
3753 | * LOCK operation | 3766 | * LOCK operation |
3754 | */ | 3767 | */ |
@@ -3765,7 +3778,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3765 | struct file_lock conflock; | 3778 | struct file_lock conflock; |
3766 | __be32 status = 0; | 3779 | __be32 status = 0; |
3767 | unsigned int strhashval; | 3780 | unsigned int strhashval; |
3768 | unsigned int cmd; | ||
3769 | int err; | 3781 | int err; |
3770 | 3782 | ||
3771 | dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", | 3783 | dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", |
@@ -3847,22 +3859,18 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3847 | switch (lock->lk_type) { | 3859 | switch (lock->lk_type) { |
3848 | case NFS4_READ_LT: | 3860 | case NFS4_READ_LT: |
3849 | case NFS4_READW_LT: | 3861 | case NFS4_READW_LT: |
3850 | if (find_readable_file(lock_stp->st_file)) { | 3862 | filp = find_readable_file(lock_stp->st_file); |
3851 | nfs4_get_vfs_file(rqstp, fp, &cstate->current_fh, NFS4_SHARE_ACCESS_READ); | 3863 | if (filp) |
3852 | filp = find_readable_file(lock_stp->st_file); | 3864 | get_lock_access(lock_stp, NFS4_SHARE_ACCESS_READ); |
3853 | } | ||
3854 | file_lock.fl_type = F_RDLCK; | 3865 | file_lock.fl_type = F_RDLCK; |
3855 | cmd = F_SETLK; | 3866 | break; |
3856 | break; | ||
3857 | case NFS4_WRITE_LT: | 3867 | case NFS4_WRITE_LT: |
3858 | case NFS4_WRITEW_LT: | 3868 | case NFS4_WRITEW_LT: |
3859 | if (find_writeable_file(lock_stp->st_file)) { | 3869 | filp = find_writeable_file(lock_stp->st_file); |
3860 | nfs4_get_vfs_file(rqstp, fp, &cstate->current_fh, NFS4_SHARE_ACCESS_WRITE); | 3870 | if (filp) |
3861 | filp = find_writeable_file(lock_stp->st_file); | 3871 | get_lock_access(lock_stp, NFS4_SHARE_ACCESS_WRITE); |
3862 | } | ||
3863 | file_lock.fl_type = F_WRLCK; | 3872 | file_lock.fl_type = F_WRLCK; |
3864 | cmd = F_SETLK; | 3873 | break; |
3865 | break; | ||
3866 | default: | 3874 | default: |
3867 | status = nfserr_inval; | 3875 | status = nfserr_inval; |
3868 | goto out; | 3876 | goto out; |
@@ -3886,7 +3894,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3886 | * Note: locks.c uses the BKL to protect the inode's lock list. | 3894 | * Note: locks.c uses the BKL to protect the inode's lock list. |
3887 | */ | 3895 | */ |
3888 | 3896 | ||
3889 | err = vfs_lock_file(filp, cmd, &file_lock, &conflock); | 3897 | err = vfs_lock_file(filp, F_SETLK, &file_lock, &conflock); |
3890 | switch (-err) { | 3898 | switch (-err) { |
3891 | case 0: /* success! */ | 3899 | case 0: /* success! */ |
3892 | update_stateid(&lock_stp->st_stateid); | 3900 | update_stateid(&lock_stp->st_stateid); |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 615f0a9f060..c6766af00d9 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1142,7 +1142,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp, | |||
1142 | 1142 | ||
1143 | u32 dummy; | 1143 | u32 dummy; |
1144 | char *machine_name; | 1144 | char *machine_name; |
1145 | int i, j; | 1145 | int i; |
1146 | int nr_secflavs; | 1146 | int nr_secflavs; |
1147 | 1147 | ||
1148 | READ_BUF(16); | 1148 | READ_BUF(16); |
@@ -1215,8 +1215,6 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp, | |||
1215 | READ_BUF(4); | 1215 | READ_BUF(4); |
1216 | READ32(dummy); | 1216 | READ32(dummy); |
1217 | READ_BUF(dummy * 4); | 1217 | READ_BUF(dummy * 4); |
1218 | for (j = 0; j < dummy; ++j) | ||
1219 | READ32(dummy); | ||
1220 | break; | 1218 | break; |
1221 | case RPC_AUTH_GSS: | 1219 | case RPC_AUTH_GSS: |
1222 | dprintk("RPC_AUTH_GSS callback secflavor " | 1220 | dprintk("RPC_AUTH_GSS callback secflavor " |
@@ -1232,7 +1230,6 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp, | |||
1232 | READ_BUF(4); | 1230 | READ_BUF(4); |
1233 | READ32(dummy); | 1231 | READ32(dummy); |
1234 | READ_BUF(dummy); | 1232 | READ_BUF(dummy); |
1235 | p += XDR_QUADLEN(dummy); | ||
1236 | break; | 1233 | break; |
1237 | default: | 1234 | default: |
1238 | dprintk("Illegal callback secflavor\n"); | 1235 | dprintk("Illegal callback secflavor\n"); |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 33b3e2b0677..1f5eae40f34 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -12,13 +12,14 @@ | |||
12 | #include <linux/nfsd/syscall.h> | 12 | #include <linux/nfsd/syscall.h> |
13 | #include <linux/lockd/lockd.h> | 13 | #include <linux/lockd/lockd.h> |
14 | #include <linux/sunrpc/clnt.h> | 14 | #include <linux/sunrpc/clnt.h> |
15 | #include <linux/sunrpc/gss_api.h> | ||
15 | 16 | ||
16 | #include "idmap.h" | 17 | #include "idmap.h" |
17 | #include "nfsd.h" | 18 | #include "nfsd.h" |
18 | #include "cache.h" | 19 | #include "cache.h" |
19 | 20 | ||
20 | /* | 21 | /* |
21 | * We have a single directory with 9 nodes in it. | 22 | * We have a single directory with several nodes in it. |
22 | */ | 23 | */ |
23 | enum { | 24 | enum { |
24 | NFSD_Root = 1, | 25 | NFSD_Root = 1, |
@@ -42,6 +43,7 @@ enum { | |||
42 | NFSD_Versions, | 43 | NFSD_Versions, |
43 | NFSD_Ports, | 44 | NFSD_Ports, |
44 | NFSD_MaxBlkSize, | 45 | NFSD_MaxBlkSize, |
46 | NFSD_SupportedEnctypes, | ||
45 | /* | 47 | /* |
46 | * The below MUST come last. Otherwise we leave a hole in nfsd_files[] | 48 | * The below MUST come last. Otherwise we leave a hole in nfsd_files[] |
47 | * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops | 49 | * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops |
@@ -187,6 +189,34 @@ static struct file_operations export_features_operations = { | |||
187 | .release = single_release, | 189 | .release = single_release, |
188 | }; | 190 | }; |
189 | 191 | ||
192 | #ifdef CONFIG_SUNRPC_GSS | ||
193 | static int supported_enctypes_show(struct seq_file *m, void *v) | ||
194 | { | ||
195 | struct gss_api_mech *k5mech; | ||
196 | |||
197 | k5mech = gss_mech_get_by_name("krb5"); | ||
198 | if (k5mech == NULL) | ||
199 | goto out; | ||
200 | if (k5mech->gm_upcall_enctypes != NULL) | ||
201 | seq_printf(m, k5mech->gm_upcall_enctypes); | ||
202 | gss_mech_put(k5mech); | ||
203 | out: | ||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static int supported_enctypes_open(struct inode *inode, struct file *file) | ||
208 | { | ||
209 | return single_open(file, supported_enctypes_show, NULL); | ||
210 | } | ||
211 | |||
212 | static struct file_operations supported_enctypes_ops = { | ||
213 | .open = supported_enctypes_open, | ||
214 | .read = seq_read, | ||
215 | .llseek = seq_lseek, | ||
216 | .release = single_release, | ||
217 | }; | ||
218 | #endif /* CONFIG_SUNRPC_GSS */ | ||
219 | |||
190 | extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); | 220 | extern int nfsd_pool_stats_open(struct inode *inode, struct file *file); |
191 | extern int nfsd_pool_stats_release(struct inode *inode, struct file *file); | 221 | extern int nfsd_pool_stats_release(struct inode *inode, struct file *file); |
192 | 222 | ||
@@ -1397,6 +1427,9 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
1397 | [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, | 1427 | [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, |
1398 | [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, | 1428 | [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, |
1399 | [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, | 1429 | [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, |
1430 | #ifdef CONFIG_SUNRPC_GSS | ||
1431 | [NFSD_SupportedEnctypes] = {"supported_krb5_enctypes", &supported_enctypes_ops, S_IRUGO}, | ||
1432 | #endif /* CONFIG_SUNRPC_GSS */ | ||
1400 | #ifdef CONFIG_NFSD_V4 | 1433 | #ifdef CONFIG_NFSD_V4 |
1401 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, | 1434 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, |
1402 | [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR}, | 1435 | [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR}, |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 2d31224b07b..6bd2f3c21f2 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -367,16 +367,12 @@ struct nfs4_file { | |||
367 | struct list_head fi_delegations; | 367 | struct list_head fi_delegations; |
368 | /* One each for O_RDONLY, O_WRONLY, O_RDWR: */ | 368 | /* One each for O_RDONLY, O_WRONLY, O_RDWR: */ |
369 | struct file * fi_fds[3]; | 369 | struct file * fi_fds[3]; |
370 | /* One each for O_RDONLY, O_WRONLY: */ | ||
371 | atomic_t fi_access[2]; | ||
372 | /* | 370 | /* |
373 | * Each open stateid contributes 1 to either fi_readers or | 371 | * Each open or lock stateid contributes 1 to either |
374 | * fi_writers, or both, depending on the open mode. A | 372 | * fi_access[O_RDONLY], fi_access[O_WRONLY], or both, depending |
375 | * delegation also takes an fi_readers reference. Lock | 373 | * on open or lock mode: |
376 | * stateid's take none. | ||
377 | */ | 374 | */ |
378 | atomic_t fi_readers; | 375 | atomic_t fi_access[2]; |
379 | atomic_t fi_writers; | ||
380 | struct file *fi_deleg_file; | 376 | struct file *fi_deleg_file; |
381 | struct file_lock *fi_lease; | 377 | struct file_lock *fi_lease; |
382 | atomic_t fi_delegees; | 378 | atomic_t fi_delegees; |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index ff93025ae2f..2e1cebde90d 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1749,8 +1749,6 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1749 | if (host_err) | 1749 | if (host_err) |
1750 | goto out_drop_write; | 1750 | goto out_drop_write; |
1751 | } | 1751 | } |
1752 | if (host_err) | ||
1753 | goto out_drop_write; | ||
1754 | host_err = vfs_rename(fdir, odentry, tdir, ndentry); | 1752 | host_err = vfs_rename(fdir, odentry, tdir, ndentry); |
1755 | if (!host_err) { | 1753 | if (!host_err) { |
1756 | host_err = commit_metadata(tfhp); | 1754 | host_err = commit_metadata(tfhp); |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 30916b06c12..c8e10216c11 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -38,6 +38,14 @@ struct unix_domain { | |||
38 | 38 | ||
39 | extern struct auth_ops svcauth_unix; | 39 | extern struct auth_ops svcauth_unix; |
40 | 40 | ||
41 | static void svcauth_unix_domain_release(struct auth_domain *dom) | ||
42 | { | ||
43 | struct unix_domain *ud = container_of(dom, struct unix_domain, h); | ||
44 | |||
45 | kfree(dom->name); | ||
46 | kfree(ud); | ||
47 | } | ||
48 | |||
41 | struct auth_domain *unix_domain_find(char *name) | 49 | struct auth_domain *unix_domain_find(char *name) |
42 | { | 50 | { |
43 | struct auth_domain *rv; | 51 | struct auth_domain *rv; |
@@ -47,7 +55,7 @@ struct auth_domain *unix_domain_find(char *name) | |||
47 | while(1) { | 55 | while(1) { |
48 | if (rv) { | 56 | if (rv) { |
49 | if (new && rv != &new->h) | 57 | if (new && rv != &new->h) |
50 | auth_domain_put(&new->h); | 58 | svcauth_unix_domain_release(&new->h); |
51 | 59 | ||
52 | if (rv->flavour != &svcauth_unix) { | 60 | if (rv->flavour != &svcauth_unix) { |
53 | auth_domain_put(rv); | 61 | auth_domain_put(rv); |
@@ -74,14 +82,6 @@ struct auth_domain *unix_domain_find(char *name) | |||
74 | } | 82 | } |
75 | EXPORT_SYMBOL_GPL(unix_domain_find); | 83 | EXPORT_SYMBOL_GPL(unix_domain_find); |
76 | 84 | ||
77 | static void svcauth_unix_domain_release(struct auth_domain *dom) | ||
78 | { | ||
79 | struct unix_domain *ud = container_of(dom, struct unix_domain, h); | ||
80 | |||
81 | kfree(dom->name); | ||
82 | kfree(ud); | ||
83 | } | ||
84 | |||
85 | 85 | ||
86 | /************************************************** | 86 | /************************************************** |
87 | * cache for IP address to unix_domain | 87 | * cache for IP address to unix_domain |