Patch series to attempt to fix submount hang
Subsystems (2)
Ian Kent
maintainercover Patch series to attempt to fix submount hang
Jim,
Here is the latest patch series I'm using to try and fix the submount hang that your seeing.
After our initial investigation I was able to use one of the tests in the connectathon test suite to fairly easily reproduce the problem. I've used that to test these current patches and I hope they are an improvement.
One of my test runs (the latest one) produced a totally different error after only 17 hours so it looks like there is another issue. I'll continue to work on that but in the mean time could you give these patches a try.
They were made against the source of the SuSE autofs-5.0.3-6.1 rpm.
Ian
---
Ian Kent (5):
autofs-5.0.3 - fix submount shutdown handling.
autofs-5.0.3 - don't abuse the ap->ghost field on NFS mount autofs-5.0.3 - mount thread create condition handling fix autofs-5.0.3 - Fix incorrect pthreads condition handling for mount requests. autofs-5.0.3 - Another fix for don't fail on empty master map.
daemon/automount.c | 82 ++++++++++++------------ daemon/direct.c | 100 +++++++++++++++++------------ daemon/indirect.c | 164 ++++++++++++++++++++++++++++++++++-------------- daemon/lookup.c | 3 - daemon/state.c | 5 + include/automount.h | 19 +++++- lib/master.c | 63 +++++++++++------- modules/lookup_file.c | 1 modules/mount_autofs.c | 4 + modules/mount_bind.c | 2 - modules/mount_nfs.c | 11 --- 11 files changed, 277 insertions(+), 177 deletions(-)
Ian Kent
maintainerPATCH 1/5 autofs-5.0.3 - Another fix for don't fail on empty master map.
autofs-5.0.3-dont-fail-on-empty-master-fix-2.patch
---
lib/master.c | 12 ++---------- modules/lookup_file.c | 1 + 2 files changed, 3 insertions(+), 10 deletions(-)
lib/master.c +2 -10
@@ -799,21 +799,13 @@ int master_read_master(struct master *master, time_t age, int readall)master_init_scan (); -if (!lookup_nss_read_master (master, age)) { -error (logopt, -"can't read master map %s" , master->name); -return 0 ; - } - +lookup_nss_read_master (master, age);master_mount_mounts (master, age, readall);master_mutex_lock (); -if (list_empty (&master->mounts)) { -master_mutex_unlock (); +if (list_empty (&master->mounts))warn (logopt,"no mounts in table" ); -return 1 ; - }master_mutex_unlock ();
modules/lookup_file.c +1 -0
@@ -475,6 +475,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)"failed to read included master map %s" , master->name);if (!master->recurse) { + master->name = save_name; master->depth--; master->recurse =0 ;fclose (f);
Ian Kent
maintainerPATCH 2/5 autofs-5.0.3 - Fix incorrect pthreads condition handling for mount requests.
In reply to Ian Kentautofs-5.0.3-mount-thread-create-cond-handling.patch
---
daemon/direct.c | 66 +++++++++++++++++++++++++++-------------------------- daemon/indirect.c | 41 +++++++++++++++++---------------- 2 files changed, 55 insertions(+), 52 deletions(-)
daemon/direct.c +34 -32
@@ -1212,7 +1212,7 @@ static void mount_mutex_unlock(void *arg)static void *do_mount_direct (void *arg) { -struct pending_args *mt; +struct pending_args *args, mt;struct autofs_point *ap;struct passwd pw;struct passwd *ppw = &pw;
@@ -1226,47 +1226,47 @@ static void *do_mount_direct(void *arg)struct stat st;int status, state; - mt = (struct pending_args *) arg; + args = (struct pending_args *) arg; status =pthread_mutex_lock (&ma_mutex);if (status)fatal (status); - ap = mt->ap; +memcpy (&mt, args,sizeof (struct pending_args )); - mt->signaled =1 ; - status =pthread_cond_signal (&mt->cond); + ap = mt.ap; + + args->signaled =1 ; + status =pthread_cond_signal (&args->cond);if (status)fatal (status);mount_mutex_unlock (NULL ); -pthread_cleanup_push (free_pending_args, mt); -pthread_cleanup_push (pending_cond_destroy, mt); -pthread_cleanup_push (mount_send_fail, mt); +pthread_cleanup_push (mount_send_fail, &mt);pthread_setcancelstate (PTHREAD_CANCEL_DISABLE , &state); - status =fstat (mt->ioctlfd, &st); + status =fstat (mt.ioctlfd, &st);if (status ==-1 ) {error (ap->logopt, -"can't stat direct mount trigger %s" , mt->name); +"can't stat direct mount trigger %s" , mt.name);pthread_setcancelstate (state,NULL );pthread_exit (NULL ); } - status =stat (mt->name, &st); -if (!S_ISDIR (st.st_mode) || st.st_dev != mt->dev) { + status =stat (mt.name, &st); +if (!S_ISDIR (st.st_mode) || st.st_dev != mt.dev) {error (ap->logopt,"direct trigger not valid or already mounted %s" , - mt->name); + mt.name);pthread_setcancelstate (state,NULL );pthread_exit (NULL ); }pthread_setcancelstate (state,NULL ); -info (ap->logopt,"attempting to mount entry %s" , mt->name); +info (ap->logopt,"attempting to mount entry %s" , mt.name);/* * Setup thread specific data values for macro
@@ -1278,8 +1278,8 @@ static void *do_mount_direct(void *arg)if (!tsv) goto cont; - tsv->uid = mt->uid; - tsv->gid = mt->gid; + tsv->uid = mt.uid; + tsv->gid = mt.gid;/* Try to get passwd info */
@@ -1297,7 +1297,7 @@ static void *do_mount_direct(void *arg) goto cont; } - status =getpwuid_r (mt->uid, ppw, pw_tmp, tmplen, pppw); + status =getpwuid_r (tsv->uid, ppw, pw_tmp, tmplen, pppw);if (status || !ppw) {error (ap->logopt,"failed to get passwd info from getpwuid_r" );free (tsv);
@@ -1351,7 +1351,7 @@ static void *do_mount_direct(void *arg) gr_tmp = tmp; pgr = &gr; ppgr = &pgr; - status =getgrgid_r (mt->gid, pgr, gr_tmp, tmplen, ppgr); + status =getgrgid_r (tsv->gid, pgr, gr_tmp, tmplen, ppgr);if (status !=ERANGE )break ; tmplen += grplen;
@@ -1388,7 +1388,7 @@ static void *do_mount_direct(void *arg) } cont: - status =lookup_nss_mount (ap,NULL , mt->name,strlen (mt->name)); + status =lookup_nss_mount (ap,NULL , mt.name,strlen (mt.name));/* * Direct mounts are always a single mount. If it fails there's * nothing to undo so just complain
@@ -1397,29 +1397,27 @@ cont:if (status) {struct mapent *me;int real_mount, set_fd; -cache_readlock (mt->mc); - me =cache_lookup_distinct (mt->mc, mt->name); +cache_readlock (mt.mc); + me =cache_lookup_distinct (mt.mc, mt.name); real_mount =is_mounted (_PATH_MOUNTED, me->key,MNTS_REAL ); set_fd = (real_mount || me->multi == me); -cache_unlock (mt->mc); +cache_unlock (mt.mc);if (set_fd) { - me->ioctlfd = mt->ioctlfd; -send_ready (ap->logopt, mt->ioctlfd, mt->wait_queue_token); + me->ioctlfd = mt.ioctlfd; +send_ready (ap->logopt, mt.ioctlfd, mt.wait_queue_token); }else { -send_ready (ap->logopt, mt->ioctlfd, mt->wait_queue_token); -close (mt->ioctlfd); +send_ready (ap->logopt, mt.ioctlfd, mt.wait_queue_token); +close (mt.ioctlfd); } -info (ap->logopt,"mounted %s" , mt->name); +info (ap->logopt,"mounted %s" , mt.name); }else { -send_fail (mt->ap->logopt, mt->ioctlfd, mt->wait_queue_token); -close (mt->ioctlfd); -info (ap->logopt,"failed to mount %s" , mt->name); +send_fail (ap->logopt, mt.ioctlfd, mt.wait_queue_token); +close (mt.ioctlfd); +info (ap->logopt,"failed to mount %s" , mt.name); }pthread_setcancelstate (state,NULL );pthread_cleanup_pop (0 ); -pthread_cleanup_pop (1 ); -pthread_cleanup_pop (1 );return NULL ; }
@@ -1548,6 +1546,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ }cache_unlock (mc); +pthread_cleanup_push (free_pending_args, mt); +pthread_cleanup_push (pending_cond_destroy, mt);pthread_cleanup_push (mount_mutex_unlock,NULL );pthread_setcancelstate (state,NULL );
@@ -1559,6 +1559,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_ }pthread_cleanup_pop (1 ); +pthread_cleanup_pop (1 ); +pthread_cleanup_pop (1 );return 0 ; }
daemon/indirect.c +21 -20
118 lines not on this page · raw message
Ian Kent
maintainerPATCH 3/5 autofs-5.0.3 - mount thread create condition handling fix
In reply to Ian Kentautofs-5.0.3-mount-thread-create-cond-handling-fix.patch
Make the mount thread creation condition mutex spacific to the thread being created.
---
daemon/direct.c | 30 +++++++++++++++++++++++------- daemon/indirect.c | 30 +++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 14 deletions(-)
daemon/direct.c +23 -7
@@ -1203,9 +1203,18 @@ static void mount_send_fail(void *arg)close (mt->ioctlfd); } +static void pending_mutex_destroy (void *arg) +{ +struct pending_args *mt = (struct pending_args *) arg; +int status =pthread_mutex_destroy (&mt->mutex); +if (status) +fatal (status); +} +static void mount_mutex_unlock (void *arg) { -int status =pthread_mutex_unlock (&ma_mutex); +struct pending_args *mt = (struct pending_args *) arg; +int status =pthread_mutex_unlock (&mt->mutex);if (status)fatal (status); }
@@ -1228,7 +1237,7 @@ static void *do_mount_direct(void *arg) args = (struct pending_args *) arg; - status =pthread_mutex_lock (&ma_mutex); + status =pthread_mutex_lock (&args->mutex);if (status)fatal (status);
@@ -1241,7 +1250,7 @@ static void *do_mount_direct(void *arg)if (status)fatal (status); -mount_mutex_unlock (NULL ); +mount_mutex_unlock (args);pthread_cleanup_push (mount_send_fail, &mt);
@@ -1518,7 +1527,11 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_if (status)fatal (status); - status =pthread_mutex_lock (&ma_mutex); + status =pthread_mutex_init (&mt->mutex,NULL ); +if (status) +fatal (status); + + status =pthread_mutex_lock (&mt->mutex);if (status)fatal (status);
@@ -1538,8 +1551,9 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_send_fail (ap->logopt, ioctlfd, pkt->wait_queue_token);close (ioctlfd);cache_unlock (mc); -mount_mutex_unlock (NULL ); +mount_mutex_unlock (mt);pending_cond_destroy (mt); +pending_mutex_destroy (mt);free_pending_args (mt);pthread_setcancelstate (state,NULL );return 1 ;
@@ -1547,13 +1561,14 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_cache_unlock (mc);pthread_cleanup_push (free_pending_args, mt); +pthread_cleanup_push (pending_mutex_destroy, mt);pthread_cleanup_push (pending_cond_destroy, mt); -pthread_cleanup_push (mount_mutex_unlock,NULL ); +pthread_cleanup_push (mount_mutex_unlock, mt);pthread_setcancelstate (state,NULL ); mt->signaled =0 ;while (!mt->signaled) { - status =pthread_cond_wait (&mt->cond, &ma_mutex); + status =pthread_cond_wait (&mt->cond, &mt->mutex);if (status)fatal (status); }
@@ -1561,6 +1576,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_pthread_cleanup_pop (1 );pthread_cleanup_pop (1 );pthread_cleanup_pop (1 ); +pthread_cleanup_pop (1 );return 0 ; }
daemon/indirect.c +23 -7
@@ -649,9 +649,18 @@ static void mount_send_fail(void *arg)send_fail (mt->ap->logopt, mt->ap->ioctlfd, mt->wait_queue_token); } +static void pending_mutex_destroy (void *arg) +{ +struct pending_args *mt = (struct pending_args *) arg; +int status =pthread_mutex_destroy (&mt->mutex); +if (status) +fatal (status); +} +static void mount_mutex_unlock (void *arg) { -int status =pthread_mutex_unlock (&ma_mutex); +struct pending_args *mt = (struct pending_args *) arg; +int status =pthread_mutex_unlock (&mt->mutex);if (status)fatal (status); }
@@ -674,7 +683,7 @@ static void *do_mount_indirect(void *arg) args = (struct pending_args *) arg; - status =pthread_mutex_lock (&ma_mutex); + status =pthread_mutex_lock (&args->mutex);if (status)fatal (status);
@@ -687,7 +696,7 @@ static void *do_mount_indirect(void *arg)if (status)fatal (status); -mount_mutex_unlock (NULL ); +mount_mutex_unlock (args);pthread_cleanup_push (mount_send_fail, &mt);
@@ -882,7 +891,11 @@ int handle_packet_missing_indirect(struct autofs_point *ap, autofs_packet_missinif (status)fatal (status); - status =pthread_mutex_lock (&ma_mutex); + status =pthread_mutex_init (&mt->mutex,NULL ); +if (status) +fatal (status); + + status =pthread_mutex_lock (&mt->mutex);if (status)fatal (status);
@@ -899,21 +912,23 @@ int handle_packet_missing_indirect(struct autofs_point *ap, autofs_packet_missinif (status) {error (ap->logopt,"expire thread create failed" );send_fail (ap->logopt, ap->ioctlfd, pkt->wait_queue_token); -mount_mutex_unlock (NULL ); +mount_mutex_unlock (mt);pending_cond_destroy (mt); +pending_mutex_destroy (mt);free_pending_args (mt);pthread_setcancelstate (state,NULL );return 1 ; }pthread_cleanup_push (free_pending_args, mt); +pthread_cleanup_push (pending_mutex_destroy, mt);pthread_cleanup_push (pending_cond_destroy, mt); -pthread_cleanup_push (mount_mutex_unlock,NULL ); +pthread_cleanup_push (mount_mutex_unlock, mt);pthread_setcancelstate (state,NULL ); mt->signaled =0 ;while (!mt->signaled) { - status =pthread_cond_wait (&mt->cond, &ma_mutex); + status =pthread_cond_wait (&mt->cond, &mt->mutex);if (status)fatal (status); }
@@ -921,6 +936,7 @@ int handle_packet_missing_indirect(struct autofs_point *ap, autofs_packet_missinpthread_cleanup_pop (1 );pthread_cleanup_pop (1 );pthread_cleanup_pop (1 ); +pthread_cleanup_pop (1 );return 0 ; }
Ian Kent
maintainerPATCH 4/5 autofs-5.0.3 - don't abuse the ap->ghost field on NFS mount
In reply to Ian Kentautofs-5.0.3-dont-abuse-ap-ghost-field.patch
Using the ap->ghost field in the autofs mount point struct, to prevent the mount point directory from being removed, when attempting a bind mount when an NFS mount is local may lead to incorrectly reading and ghosting the map. This can happen if a mount request comes in during a map re-read when the autofs map doesn't have the browse option set. This patch corrects that by using the existence check in the bind mount module instead of the hack of changing the struct field.
---
modules/mount_bind.c | 2 +- modules/mount_nfs.c | 11 ----------- 2 files changed, 1 insertions(+), 12 deletions(-)
modules/mount_bind.c +1 -1
@@ -144,7 +144,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, intif (ap->type !=LKP_INDIRECT )return 1 ; -if ((!ap->ghost && name_len) || !existed) +if ((!ap->ghost && name_len) && !existed)rmdir_path (ap, fullpath, ap->dev);return err;
modules/mount_nfs.c +0 -11
@@ -62,7 +62,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int {char *fullpath, buf[MAX_ERR_BUF ];struct host *this, *hosts =NULL ; -unsigned int save_ghost = ap->ghost;unsigned int vers;char *nfsoptions =NULL ;int len, rlen, status, err, existed =1 ;
@@ -186,13 +185,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, intif (!status) existed =0 ; -/* -* We need to stop the bind mount module from removing the -* mount point directory if a bind attempt fails so abuse -* the ap->ghost field for this. -*/ - ap->ghost =1 ; - this = hosts;while (this) {char *loc, *port_opt =NULL ;
@@ -229,7 +221,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int/* Success - we're done */ if (!err) {free_host_list (&hosts); - ap->ghost = save_ghost;return 0 ; }
@@ -271,7 +262,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, intinfo (ap->logopt,MODPREFIX "mounted %s on %s" , loc, fullpath);free (loc);free_host_list (&hosts); - ap->ghost = save_ghost;return 0 ; }
@@ -281,7 +271,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int forced_fail:free_host_list (&hosts); - ap->ghost = save_ghost;/* If we get here we've failed to complete the mount */
Ian Kent
maintainerPATCH 5/5 autofs-5.0.3 - fix submount shutdown handling.
In reply to Ian Kentautofs-5.0.3-submount-shutdown-recovery-7.patch
When using submount maps on a busy system autofs can hang.
This patch improves the submount shutdown logic and allows submounts that become busy during shutdown to recover.
---
daemon/automount.c | 82 +++++++++++++++++++++--------------------- daemon/direct.c | 4 +- daemon/indirect.c | 93 +++++++++++++++++++++++++++++++++++++----------- daemon/lookup.c | 3 -- daemon/state.c | 5 ++- include/automount.h | 19 +++++++++- lib/master.c | 51 +++++++++++++++++++------- modules/mount_autofs.c | 4 +- 8 files changed, 172 insertions(+), 89 deletions(-)
daemon/automount.c +41 -41
@@ -1465,13 +1465,9 @@ static void handle_mounts_cleanup(void *arg)/* If we have been canceled then we may hold the state mutex. */ mutex_operation_wait (&ap->state_mutex); -alarm_delete (ap); -st_remove_tasks (ap); - -umount_autofs (ap,1 ); -destroy_logpri_fifo (ap); -master_signal_submount (ap,MASTER_SUBMNT_JOIN ); +if (submount) +master_signal_submount (ap,MASTER_SUBMNT_JOIN );master_remove_mapent (ap->entry);master_free_mapent_sources (ap->entry,1 );master_free_mapent (ap->entry);
@@ -1533,71 +1529,75 @@ void *handle_mounts(void *arg)if (!ap->submount && ap->exp_timeout)alarm_add (ap, ap->exp_runfreq +rand () % ap->exp_runfreq); -pthread_cleanup_push (handle_mounts_cleanup, ap); -pthread_setcancelstate (cancel_state,NULL ); -state_mutex_unlock (ap); +pthread_setcancelstate (cancel_state,NULL );while (ap->state !=ST_SHUTDOWN ) {if (handle_packet (ap)) { -int ret, result; +int ret, cur_state; + +/* +* If we're a submount we need to ensure our parent +* doesn't try to mount us again until our shutdown +* is complete and that any outstanding mounts are +* completed before we try to shutdown. +*/ +pthread_setcancelstate (PTHREAD_CANCEL_DISABLE , &cur_state);state_mutex_lock (ap); + +if (ap->state !=ST_SHUTDOWN ) { +if (!ap->submount) +alarm_add (ap, ap->exp_runfreq); +state_mutex_unlock (ap); +/* Return to ST_READY is done immediately */ +st_add_task (ap,ST_READY ); +pthread_setcancelstate (cur_state,NULL ); +continue ; + } + +alarm_delete (ap); +st_remove_tasks (ap); +/* * For a direct mount map all mounts have already gone -* by the time we get here. +* by the time we get here and since we only ever +* umount direct mounts at shutdown there is no need +* to check for possible recovery. */ if (ap->type ==LKP_DIRECT ) { - status =1 ; +umount_autofs (ap,1 );state_mutex_unlock (ap);break ; }/* -* If the ioctl fails assume the kernel doesn't have -* AUTOFS_IOC_ASKUMOUNT and just continue. +* If umount_autofs returns non-zero it wasn't able +* to complete the umount and has left the mount intact +* so we can continue. This can happen if a lookup +* occurs while we're trying to umount. */ - ret =ioctl (ap->ioctlfd,AUTOFS_IOC_ASKUMOUNT , &result); -if (ret ==-1 ) { + ret =umount_autofs (ap,1 ); +if (!ret) {state_mutex_unlock (ap);break ; } -/* OK to exit */ -if (ap->state ==ST_SHUTDOWN ) { -if (result) { -state_mutex_unlock (ap); -break ; - } -#ifdef ENABLE_IGNORE_BUSY_MOUNTS -/* -* There weren't any active mounts but if the -* filesystem is busy there may be a mount -* request in progress so return to the ready -* state unless a shutdown has been explicitly -* requested. -*/ -if (ap->shutdown) { -state_mutex_unlock (ap); -break ; - } -#endif - } -/* Failed shutdown returns to ready */ warn (ap->logopt,"can't shutdown: filesystem %s still busy" , ap->path);if (!ap->submount)alarm_add (ap, ap->exp_runfreq); -nextstate (ap->state_pipe[1 ],ST_READY ); -state_mutex_unlock (ap); +/* Return to ST_READY is done immediately */ +st_add_task (ap,ST_READY ); +pthread_setcancelstate (cur_state,NULL ); + } } -pthread_cleanup_pop (1 ); -sched_yield (); +handle_mounts_cleanup (ap);return NULL ; }
daemon/direct.c +2 -2
@@ -867,12 +867,12 @@ void *expire_proc_direct(void *arg)if (status)fatal (status); +pthread_cleanup_push (expire_cleanup, &ec); + status =pthread_mutex_unlock (&ea->mutex);if (status)fatal (status); -pthread_cleanup_push (expire_cleanup, &ec); - left =0 ; mnts =tree_make_mnt_tree (_PROC_MOUNTS,"/" );
daemon/indirect.c +71 -22
147 lines not on this page · raw message
daemon/lookup.c +0 -3
@@ -1139,8 +1139,6 @@ int lookup_source_close_ioctlfd(struct autofs_point *ap, const char *key)struct mapent *me;int ret =0 ; -pthread_cleanup_push (master_source_lock_cleanup, entry); -master_source_readlock (entry); map = entry->maps;while (map) { mc = map->mc;
@@ -1158,7 +1156,6 @@ int lookup_source_close_ioctlfd(struct autofs_point *ap, const char *key)cache_unlock (mc); map = map->next; } -pthread_cleanup_pop (1 );return ret; }
daemon/state.c +3 -2
@@ -213,8 +213,10 @@ static unsigned int st_ready(struct autofs_point *ap)debug (ap->logopt,"st_ready(): state = %d path %s" , ap->state, ap->path); +state_mutex_lock (ap); ap->shutdown =0 ; ap->state =ST_READY ; +state_mutex_unlock (ap);if (ap->submount)master_signal_submount (ap,MASTER_SUBMNT_CONTINUE );
@@ -677,9 +679,8 @@ int st_add_task(struct autofs_point *ap, enum states state)/* Task termination marker, poke state machine */ if (state ==ST_READY ) { -state_mutex_lock (ap); +/* NOTE: no state mutex lock here */ st_ready (ap); -state_mutex_unlock (ap);st_mutex_lock ();
include/automount.h +17 -2
@@ -457,8 +457,9 @@ struct autofs_point {* host from which to mount */ struct autofs_point *parent;/* Owner of mounts list for submount */ pthread_mutex_t mounts_mutex;/* Protect mount lists */ -pthread_cond_t mounts_cond;/* Submounts condition variable */ -unsigned int mounts_signaled;/* Submount signals task complete */ +pthread_cond_t submount_cond;/* Submount condition variable */ +pthread_mutex_t submount_mutex;/* Submount condition mutex variabe */ +unsigned int submount_signaled;/* Submount signals task complete */ struct list_head mounts;/* List of autofs mounts at current level */ unsigned int submount;/* Is this a submount */ unsigned int shutdown;/* Shutdown notification */
@@ -520,6 +521,20 @@ do { \fatal (_m_unlock); \ } while(0) +#define submount_mutex_lock (ap) \ +do { \ + int _s_lock = pthread_mutex_lock(&ap->submount_mutex); \ + if (_s_lock) \ + fatal(_s_lock); \ +} while (0) + +#define submount_mutex_unlock (ap) \ +do { \ + int _s_unlock = pthread_mutex_unlock(&ap->submount_mutex); \ + if (_s_unlock) \ + fatal(_s_unlock); \ +} while(0) +/* Expire alarm handling routines */ int alarm_start_handler (void );int alarm_add (struct autofs_point *ap,time_t seconds);
lib/master.c +36 -15
109 lines not on this page · raw message
modules/mount_autofs.c +2 -2
@@ -266,12 +266,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, ap->submnt_count++;list_add (&nap->mounts, &ap->submounts); -mounts_mutex_unlock (ap); - status =pthread_mutex_unlock (&suc.mutex);if (status)fatal (status); +mounts_mutex_unlock (ap); +return 0 ; }