The patch titled Convert lockd to use the newer mutex instead of the older semaphore has been added to the -mm tree. Its filename is knfsd-lockd-introduce-nsm_handle-sem2mutex.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Convert lockd to use the newer mutex instead of the older semaphore From: Neil Brown <neilb@xxxxxxx> Both the (recently introduces) nsm_sema and the older f_sema are converted over. Cc: Olaf Kirch <okir@xxxxxxx> Signed-off-by: Neil Brown <neilb@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/lockd/host.c | 11 ++++++----- fs/lockd/svclock.c | 22 +++++++++++----------- fs/lockd/svcsubs.c | 2 +- include/linux/lockd/lockd.h | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) diff -puN fs/lockd/host.c~knfsd-lockd-introduce-nsm_handle-sem2mutex fs/lockd/host.c --- a/fs/lockd/host.c~knfsd-lockd-introduce-nsm_handle-sem2mutex +++ a/fs/lockd/host.c @@ -436,7 +436,7 @@ nlm_gc_hosts(void) * Manage NSM handles */ static LIST_HEAD(nsm_handles); -static DECLARE_MUTEX(nsm_sema); +static DEFINE_MUTEX(nsm_mutex); static struct nsm_handle * __nsm_find(const struct sockaddr_in *sin, @@ -458,7 +458,7 @@ __nsm_find(const struct sockaddr_in *sin return NULL; } - down(&nsm_sema); + mutex_lock(&nsm_mutex); list_for_each(pos, &nsm_handles) { nsm = list_entry(pos, struct nsm_handle, sm_link); @@ -488,7 +488,8 @@ __nsm_find(const struct sockaddr_in *sin list_add(&nsm->sm_link, &nsm_handles); } -out: up(&nsm_sema); +out: + mutex_unlock(&nsm_mutex); return nsm; } @@ -507,11 +508,11 @@ nsm_release(struct nsm_handle *nsm) if (!nsm) return; if (atomic_read(&nsm->sm_count) == 1) { - down(&nsm_sema); + mutex_lock(&nsm_mutex); if (atomic_dec_and_test(&nsm->sm_count)) { list_del(&nsm->sm_link); kfree(nsm); } - up(&nsm_sema); + mutex_unlock(&nsm_mutex); } } diff -puN fs/lockd/svclock.c~knfsd-lockd-introduce-nsm_handle-sem2mutex fs/lockd/svclock.c --- a/fs/lockd/svclock.c~knfsd-lockd-introduce-nsm_handle-sem2mutex +++ a/fs/lockd/svclock.c @@ -254,9 +254,9 @@ static void nlmsvc_free_block(struct kre dprintk("lockd: freeing block %p...\n", block); /* Remove block from file's list of blocks */ - down(&file->f_sema); + mutex_lock(&file->f_mutex); list_del_init(&block->b_flist); - up(&file->f_sema); + mutex_unlock(&file->f_mutex); nlmsvc_freegrantargs(block->b_call); nlm_release_call(block->b_call); @@ -281,7 +281,7 @@ void nlmsvc_traverse_blocks(struct nlm_h struct nlm_block *block, *next; restart: - down(&file->f_sema); + mutex_lock(&file->f_mutex); list_for_each_entry_safe(block, next, &file->f_blocks, b_flist) { if (!match(block->b_host, host)) continue; @@ -290,12 +290,12 @@ restart: if (list_empty(&block->b_list)) continue; kref_get(&block->b_count); - up(&file->f_sema); + mutex_unlock(&file->f_mutex); nlmsvc_unlink_block(block); nlmsvc_release_block(block); goto restart; } - up(&file->f_sema); + mutex_unlock(&file->f_mutex); } /* @@ -354,7 +354,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, stru lock->fl.fl_flags &= ~FL_SLEEP; again: /* Lock file against concurrent access */ - down(&file->f_sema); + mutex_lock(&file->f_mutex); /* Get existing block (in case client is busy-waiting) */ block = nlmsvc_lookup_block(file, lock); if (block == NULL) { @@ -392,10 +392,10 @@ again: /* If we don't have a block, create and initialize it. Then * retry because we may have slept in kmalloc. */ - /* We have to release f_sema as nlmsvc_create_block may try to + /* We have to release f_mutex as nlmsvc_create_block may try to * to claim it while doing host garbage collection */ if (newblock == NULL) { - up(&file->f_sema); + mutex_unlock(&file->f_mutex); dprintk("lockd: blocking on this lock (allocating).\n"); if (!(newblock = nlmsvc_create_block(rqstp, file, lock, cookie))) return nlm_lck_denied_nolocks; @@ -405,7 +405,7 @@ again: /* Append to list of blocked */ nlmsvc_insert_block(newblock, NLM_NEVER); out: - up(&file->f_sema); + mutex_unlock(&file->f_mutex); nlmsvc_release_block(newblock); nlmsvc_release_block(block); dprintk("lockd: nlmsvc_lock returned %u\n", ret); @@ -489,9 +489,9 @@ nlmsvc_cancel_blocked(struct nlm_file *f (long long)lock->fl.fl_start, (long long)lock->fl.fl_end); - down(&file->f_sema); + mutex_lock(&file->f_mutex); block = nlmsvc_lookup_block(file, lock); - up(&file->f_sema); + mutex_unlock(&file->f_mutex); if (block != NULL) { status = nlmsvc_unlink_block(block); nlmsvc_release_block(block); diff -puN fs/lockd/svcsubs.c~knfsd-lockd-introduce-nsm_handle-sem2mutex fs/lockd/svcsubs.c --- a/fs/lockd/svcsubs.c~knfsd-lockd-introduce-nsm_handle-sem2mutex +++ a/fs/lockd/svcsubs.c @@ -106,7 +106,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, goto out_unlock; memcpy(&file->f_handle, f, sizeof(struct nfs_fh)); - init_MUTEX(&file->f_sema); + mutex_init(&file->f_mutex); INIT_HLIST_NODE(&file->f_list); INIT_LIST_HEAD(&file->f_blocks); diff -puN include/linux/lockd/lockd.h~knfsd-lockd-introduce-nsm_handle-sem2mutex include/linux/lockd/lockd.h --- a/include/linux/lockd/lockd.h~knfsd-lockd-introduce-nsm_handle-sem2mutex +++ a/include/linux/lockd/lockd.h @@ -111,7 +111,7 @@ struct nlm_file { struct list_head f_blocks; /* blocked locks */ unsigned int f_locks; /* guesstimate # of locks */ unsigned int f_count; /* reference count */ - struct semaphore f_sema; /* avoid concurrent access */ + struct mutex f_mutex; /* avoid concurrent access */ }; /* _ Patches currently in -mm which might be from neilb@xxxxxxx are vfs-destroy-the-dentries-contributed-by-a-superblock-on-unmounting.patch knfsd-knfsd-add-some-missing-newlines-in-printks.patch knfsd-knfsd-remove-an-unused-variable-from-e_show.patch knfsd-knfsd-remove-an-unused-variable-from-auth_unix_lookup.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes.patch knfsd-add-a-callback-for-when-last-rpc-thread-finishes-tidy.patch knfsd-be-more-selective-in-which-sockets-lockd-listens-on.patch knfsd-remove-nfsd_versbits-as-intermediate-storage-for-desired-versions.patch knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers.patch knfsd-separate-out-some-parts-of-nfsd_svc-which-start-nfs-servers-tweaks.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-tidy.patch knfsd-define-new-nfsdfs-file-portlist-contains-list-of-ports-fix.patch knfsd-allow-sockets-to-be-passed-to-nfsd-via-portlist.patch knfsd-use-seq_start_token-instead-of-hardcoded-magic-void1.patch knfsd-have-ext2-reject-file-handles-with-bad-inode-numbers-early.patch knfsd-have-ext2-reject-file-handles-with-bad-inode-numbers-early-tidy.patch knfsd-make-ext3-reject-filehandles-referring-to-invalid-inode-numbers.patch knfsd-make-ext3-reject-filehandles-referring-to-invalid-inode-numbers-tidy.patch knfsd-drop-serv-option-to-svc_recv-and-svc_process.patch knfsd-drop-serv-option-to-svc_recv-and-svc_process-nfs-callback-fix-nfs-callback-fix.patch knfsd-check-return-value-of-lockd_up-in-write_ports.patch knfsd-move-makesock-failed-warning-into-make_socks.patch knfsd-correctly-handle-error-condition-from-lockd_up.patch knfsd-move-tempsock-aging-to-a-timer.patch knfsd-move-tempsock-aging-to-a-timer-tidy.patch knfsd-convert-sk_inuse-to-atomic_t.patch knfsd-use-new-lock-for-svc_sock-deferred-list.patch knfsd-convert-sk_reserved-to-atomic_t.patch knfsd-test-and-set-sk_busy-atomically.patch knfsd-split-svc_serv-into-pools.patch knfsd-split-svc_serv-into-pools-fix.patch knfsd-add-svc_get.patch knfsd-add-svc_set_num_threads.patch knfsd-use-svc_set_num_threads-to-manage-threads-in-knfsd.patch knfsd-make-rpc-threads-pools-numa-aware.patch knfsd-make-rpc-threads-pools-numa-aware-fix.patch knfsd-allow-admin-to-set-nthreads-per-node.patch nfsd-lockdep-annotation.patch knfsd-nfsd-lockdep-annotation-fix.patch knfsd-call-lockd_down-when-closing-a-socket-via-a-write-to-nfsd-portlist.patch knfsd-protect-update-to-sn_nrthreads-with-lock_kernel.patch knfsd-fixed-handling-of-lockd-fail-when-adding-nfsd-socket.patch knfsd-replace-two-page-lists-in-struct-svc_rqst-with-one.patch knfsd-avoid-excess-stack-usage-in-svc_tcp_recvfrom.patch knfsd-prepare-knfsd-for-support-of-rsize-wsize-of-up-to-1mb-over-tcp.patch knfsd-allow-max-size-of-nfsd-payload-to-be-configured.patch knfsd-make-nfsd-readahead-params-cache-smp-friendly.patch knfsd-knfsd-cache-ipmap-per-tcp-socket.patch knfsd-hide-use-of-lockds-h_monitored-flag.patch knfsd-consolidate-common-code-for-statd-lockd-notification.patch knfsd-when-looking-up-a-lockd-host-pass-hostname-length.patch knfsd-lockd-introduce-nsm_handle.patch knfsd-misc-minor-fixes-indentation-changes.patch knfsd-lockd-make-nlm_host_rebooted-use-the-nsm_handle.patch knfsd-lockd-make-the-nsm-upcalls-use-the-nsm_handle.patch knfsd-lockd-make-the-hash-chains-use-a-hlist_node.patch knfsd-lockd-change-list-of-blocked-list-to-list_node.patch knfsd-change-nlm_file-to-use-a-hlist.patch knfsd-lockd-make-nlm_traverse_-more-flexible.patch knfsd-lockd-add-nlm_destroy_host.patch knfsd-simplify-nlmsvc_invalidate_all.patch knfsd-lockd-optionally-use-hostnames-for-identifying-peers.patch knfsd-make-nlmclnt_next_cookie-smp-safe.patch knfsd-match-granted_res-replies-using-cookies.patch knfsd-export-nsm_local_state-to-user-space-via-sysctl.patch knfsd-lockd-fix-use-of-h_nextrebind.patch knfsd-register-all-rpc-programs-with-portmapper-by-default.patch knfsd-lockd-introduce-nsm_handle-sem2mutex.patch md-the-scheduled-removal-of-the-start_array-ioctl-for-md.patch md-fix-a-comment-that-is-wrong-in-raid5h.patch md-factor-out-part-of-raid10d-into-a-separate-function.patch md-replace-magic-numbers-in-sb_dirty-with-well-defined-bit-flags.patch md-remove-the-working_disks-and-failed_disks-from-raid5-state-data.patch md-remove-working_disks-from-raid10-state.patch md-new-sysfs-interface-for-setting-bits-in-the-write-intent-bitmap.patch md-remove-unnecessary-variable-x-in-stripe_to_pdidx.patch md-factor-out-part-of-raid1d-into-a-separate-function.patch md-remove-working_disks-from-raid1-state-data.patch md-improve-locking-around-error-handling.patch md-define-backing_dev_infocongested_fn-for-raid0-and-linear.patch md-define-congested_fn-for-raid1-raid10-and-multipath.patch md-add-a-congested_fn-function-for-raid5-6.patch md-make-messages-about-resync-recovery-etc-more-specific.patch md-dm-reduce-stack-usage-with-stacked-block-devices.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html