The patch titled knfsd: Correctly handle error condition from lockd_up has been removed from the -mm tree. Its filename is knfsd-correctly-handle-error-condition-from-lockd_up.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ Subject: knfsd: Correctly handle error condition from lockd_up From: NeilBrown <neilb@xxxxxxx> If lockd_up fails - what should we expect? Do we have to later call lockd_down? Well the nfs client thinks "no", the nfs server thinks "yes". lockd thinks "yes". The only answer that really makes sense is "no" !! So: Make lockd_up only increment nlmsvc_users on success. Make nfsd handle errors from lockd_up properly. Make sure lockd_up(0) never fails when lockd is running so that the 'reclaimer' call to lockd_up doesn't need to be error checked. Cc: "J. Bruce Fields" <bfields@xxxxxxxxxxxx> Signed-off-by: Neil Brown <neilb@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/lockd/clntlock.c | 2 +- fs/lockd/svc.c | 12 +++++------- fs/nfsd/nfssvc.c | 16 ++++++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff -puN fs/lockd/clntlock.c~knfsd-correctly-handle-error-condition-from-lockd_up fs/lockd/clntlock.c --- a/fs/lockd/clntlock.c~knfsd-correctly-handle-error-condition-from-lockd_up +++ a/fs/lockd/clntlock.c @@ -202,7 +202,7 @@ reclaimer(void *ptr) /* This one ensures that our parent doesn't terminate while the * reclaim is in progress */ lock_kernel(); - lockd_up(0); + lockd_up(0); /* note: this cannot fail as lockd is already running */ nlmclnt_prepare_reclaim(host); /* First, reclaim all locks that have been marked. */ diff -puN fs/lockd/svc.c~knfsd-correctly-handle-error-condition-from-lockd_up fs/lockd/svc.c --- a/fs/lockd/svc.c~knfsd-correctly-handle-error-condition-from-lockd_up +++ a/fs/lockd/svc.c @@ -254,15 +254,11 @@ lockd_up(int proto) /* Maybe add a 'fami mutex_lock(&nlmsvc_mutex); /* - * Unconditionally increment the user count ... this is - * the number of clients who _want_ a lockd process. - */ - nlmsvc_users++; - /* * Check whether we're already up and running. */ if (nlmsvc_pid) { - error = make_socks(nlmsvc_serv, proto); + if (proto) + error = make_socks(nlmsvc_serv, proto); goto out; } @@ -270,7 +266,7 @@ lockd_up(int proto) /* Maybe add a 'fami * Sanity check: if there's no pid, * we should be the first user ... */ - if (nlmsvc_users > 1) + if (nlmsvc_users) printk(KERN_WARNING "lockd_up: no pid, %d users??\n", nlmsvc_users); @@ -302,6 +298,8 @@ lockd_up(int proto) /* Maybe add a 'fami destroy_and_out: svc_destroy(serv); out: + if (!error) + nlmsvc_users++; mutex_unlock(&nlmsvc_mutex); return error; } diff -puN fs/nfsd/nfssvc.c~knfsd-correctly-handle-error-condition-from-lockd_up fs/nfsd/nfssvc.c --- a/fs/nfsd/nfssvc.c~knfsd-correctly-handle-error-condition-from-lockd_up +++ a/fs/nfsd/nfssvc.c @@ -221,18 +221,22 @@ static int nfsd_init_socks(int port) if (!list_empty(&nfsd_serv->sv_permsocks)) return 0; - error = svc_makesock(nfsd_serv, IPPROTO_UDP, port); - if (error < 0) - return error; error = lockd_up(IPPROTO_UDP); + if (error >= 0) { + error = svc_makesock(nfsd_serv, IPPROTO_UDP, port); + if (error < 0) + lockd_down(); + } if (error < 0) return error; #ifdef CONFIG_NFSD_TCP - error = svc_makesock(nfsd_serv, IPPROTO_TCP, port); - if (error < 0) - return error; error = lockd_up(IPPROTO_TCP); + if (error >= 0) { + error = svc_makesock(nfsd_serv, IPPROTO_TCP, port); + if (error < 0) + lockd_down(); + } if (error < 0) return error; #endif _ Patches currently in -mm which might be from neilb@xxxxxxx are origin.patch vfs-destroy-the-dentries-contributed-by-a-superblock-on-unmounting.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-replace-two-page-lists-in-struct-svc_rqst-with-one-fix.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-lockd-introduce-nsm_handle-fix.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 knfsd-svcrpc-gss-factor-out-some-common-wrapping-code.patch knfsd-svcrpc-gss-fix-failure-on-svc_denied-in-integrity-case.patch knfsd-svcrpc-use-consistent-variable-name-for-the-reply-state.patch knfsd-nfsd4-refactor-exp_pseudoroot.patch knfsd-nfsd4-clean-up-exp_pseudoroot.patch knfsd-nfsd4-acls-relax-the-nfsv4-posix-mapping.patch knfsd-nfsd4-acls-fix-inheritance.patch knfsd-nfsd4-acls-simplify-nfs4_acl_nfsv4_to_posix-interface.patch knfsd-nfsd4-acls-fix-handling-of-zero-length-acls.patch knfsd-add-nfs-export-support-to-tmpfs.patch knfsd-lockd-fix-refount-on-nsm.patch knfsd-fix-auto-sizing-of-nfsd-request-reply-buffers.patch knfsd-close-a-race-opportunity-in-d_splice_alias.patch knfsd-nfsd-store-export-path-in-export.patch knfsd-nfsd4-fslocations-data-structures.patch knfsd-nfsd4-fslocations-data-structures-fix.patch knfsd-nfsd4-xdr-encoding-for-fs_locations.patch knfsd-nfsd4-actually-use-all-the-pieces-to-implement-referrals.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-fix-duplicity-of-levels-in-mdtxt.patch md-remove-max_md_devs-which-is-an-arbitrary-limit.patch md-remove-experimental-classification-from-raid5-reshape.patch md-use-ffz-instead-of-find_first_set-to-convert-multiplier-to-shift.patch md-allow-set_bitmap_file-to-work-on-64bit-kernel-with-32bit-userspace.patch md-add-error-reporting-to-superblock-write-failure.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