95 lines
2.7 KiB
Diff
95 lines
2.7 KiB
Diff
|
commit a5ea57a64a1d70486e8d8ab2da944e50ca51b836
|
||
|
Author: zoulasc <christos@zoulas.com>
|
||
|
Date: Tue Mar 8 23:31:26 2016 -0500
|
||
|
|
||
|
- add more debugging in the unmount path
|
||
|
- if the EXPIRE_MULTI call fails, with EAGAIN, fail back to the EXPIRE call
|
||
|
seems to fix unmounting with nfsv4 volumes.
|
||
|
|
||
|
diff --git a/conf/autofs/autofs_linux.c b/conf/autofs/autofs_linux.c
|
||
|
index d543979..5b4ac06 100644
|
||
|
--- a/conf/autofs/autofs_linux.c
|
||
|
+++ b/conf/autofs/autofs_linux.c
|
||
|
@@ -365,6 +365,7 @@ autofs_expire_one(am_node *mp, char *name, autofs_wqt_t token)
|
||
|
|
||
|
ap = find_ap(ap_path);
|
||
|
if (ap == NULL) {
|
||
|
+ dlog("%s: could not find %s", __func__, ap_path);
|
||
|
/* not found??? not sure what to do here... */
|
||
|
send_fail(fh->ioctlfd, token);
|
||
|
goto out;
|
||
|
@@ -376,6 +377,7 @@ autofs_expire_one(am_node *mp, char *name, autofs_wqt_t token)
|
||
|
p->next = fh->pending_umounts;
|
||
|
fh->pending_umounts = p;
|
||
|
|
||
|
+ dlog("%s: unmount for %s", __func__, ap_path);
|
||
|
unmount_mp(ap);
|
||
|
|
||
|
out:
|
||
|
@@ -426,6 +428,7 @@ autofs_missing_one(am_node *mp, autofs_wqt_t wait_queue_token, char *name)
|
||
|
dlog("Mount still pending, not sending autofs reply yet");
|
||
|
return;
|
||
|
}
|
||
|
+ dlog("%s: lookup failed for %s/%s", __func__, mp->am_path, name);
|
||
|
autofs_lookup_failed(mp, name);
|
||
|
}
|
||
|
mp->am_stats.s_lookup++;
|
||
|
@@ -872,15 +875,42 @@ autofs_compute_mount_flags(mntent_t *mnt)
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
+static int autofs_expire_4(am_node *mp)
|
||
|
+{
|
||
|
+ struct autofs_packet_expire pkt;
|
||
|
+ autofs_fh_t *fh = mp->am_autofs_fh;
|
||
|
+
|
||
|
+ dlog("Calling AUTOFS_IOC_EXPIRE");
|
||
|
+ if (ioctl(fh->ioctlfd, AUTOFS_IOC_EXPIRE, &pkt) == -1)
|
||
|
+ {
|
||
|
+ dlog("AUTOFS_IOC_EXPIRE for %s failed %d", mp->am_path, errno);
|
||
|
+ return -1;
|
||
|
+ }
|
||
|
+
|
||
|
+ autofs_handle_expire(mp, &pkt);
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
|
||
|
#if AUTOFS_MAX_PROTO_VERSION >= 4
|
||
|
static int autofs_timeout_mp_task(void *arg)
|
||
|
{
|
||
|
am_node *mp = (am_node *)arg;
|
||
|
autofs_fh_t *fh = mp->am_autofs_fh;
|
||
|
- int now = 0;
|
||
|
-
|
||
|
- while (ioctl(fh->ioctlfd, AUTOFS_IOC_EXPIRE_MULTI, &now) == 0);
|
||
|
+ int how = AUTOFS_EXP_IMMEDIATE;
|
||
|
+
|
||
|
+ for (;;)
|
||
|
+ {
|
||
|
+ dlog("Calling AUTOFS_IOC_EXPIRE_MULTI");
|
||
|
+ if (ioctl(fh->ioctlfd, AUTOFS_IOC_EXPIRE_MULTI, &how) == -1)
|
||
|
+ {
|
||
|
+ dlog("AUTOFS_IOC_EXPIRE_MULTI for %s failed %d", mp->am_path, errno);
|
||
|
+ if (errno != EAGAIN)
|
||
|
+ break;
|
||
|
+ if (autofs_expire_4(mp) == -1)
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ }
|
||
|
return 0;
|
||
|
}
|
||
|
#endif /* AUTOFS_MAX_PROTO_VERSION >= 4 */
|
||
|
@@ -895,9 +925,8 @@ void autofs_timeout_mp(am_node *mp)
|
||
|
mp->am_autofs_ttl = now + gopt.am_timeo_w;
|
||
|
|
||
|
if (fh->version < 4) {
|
||
|
- struct autofs_packet_expire pkt;
|
||
|
- while (ioctl(fh->ioctlfd, AUTOFS_IOC_EXPIRE, &pkt) == 0)
|
||
|
- autofs_handle_expire(mp, &pkt);
|
||
|
+ while (autofs_expire_4(mp) == 0)
|
||
|
+ continue;
|
||
|
return;
|
||
|
}
|
||
|
|