+2005-07-25 Erez Zadok <ezk@cs.sunysb.edu>
+
+ * amd/conf.c (gopt_forced_unmounts): check Linux kernel version
+ and alert if your version may be too old for MNT_FORCE to work
+ (before 2.4.0) or for MNT_DETACH to work (before 2.6.0).
+ Otherwise it may be impossible to pin down the exact kernel
+ version in which we should enable this feature.
+
+ * conf/umount/umount_linux.c (umount2_fs): if MNT_FORCE returned
+ EBUSY, then don't try to stat(2) before MNT_DETACH because it
+ could hang.
+
2005-07-21 Erez Zadok <ezk@cs.sunysb.edu>
* conf/umount/umount_linux.c (umount_fs): cleanup this function,
* SUCH DAMAGE.
*
*
- * $Id: conf.c,v 1.33 2005/07/20 03:32:30 ezk Exp $
+ * $Id: conf.c,v 1.34 2005/07/25 23:49:41 ezk Exp $
*
*/
fprintf(stderr, "conf: forced_unmounts unsupported on this system.\n");
return 1;
#else /* defined(MNT2_GEN_OPT_DETACH) || defined(MNT2_GEN_OPT_FORCE) */
+# ifdef __linux__
+ /*
+ * HACK ALERT: Linux has had MNT_FORCE since 2.2, but it hasn't gotten
+ * stable until 2.4. And it had MNT_DETACH since 2.4, but it hasn't
+ * gotten stable since 2.6. So alert users if they're trying to use a
+ * feature that may not work well on their older kernel.
+ */
+ {
+ struct utsname un;
+ if (uname(&un) >= 0) {
+# ifdef MNT2_GEN_OPT_FORCE
+ if (strcmp(un.release, "2.4.0") < 0)
+ fprintf(stderr, "warning: forced-unmounts (MNT_FORCE) may not work well before 2.4.0\n");
+# endif /* MNT2_GEN_OPT_FORCE */
+# ifdef MNT2_GEN_OPT_DETACH
+ if (strcmp(un.release, "2.6.0") < 0)
+ fprintf(stderr, "warning: lazy-unmounts (MNT_DETACH) may not work well before 2.6.0\n");
+# endif /* MNT2_GEN_OPT_DETACH */
+ }
+ }
+# endif /* __linux__ */
gopt.flags |= CFM_FORCED_UNMOUNTS;
return 0;
#endif /* defined(MNT2_GEN_OPT_DETACH) || defined(MNT2_GEN_OPT_FORCE) */
* SUCH DAMAGE.
*
*
- * $Id: umount_linux.c,v 1.7 2005/07/21 05:22:47 ezk Exp $
+ * $Id: umount_linux.c,v 1.8 2005/07/25 23:49:41 ezk Exp $
*
*/
* only do the forced unmount if the older Amd process died.
*/
if (unmount_flags & AMU_UMOUNT_DETACH) {
- struct stat dummy;
- dlog("umount_fs: try stat() before unmount/detach");
- error = stat(mntdir, &dummy);
+ /*
+ * If I got an EBUSY from the above FORCE, then don't try to stat(), or
+ * it will hang.
+ */
+ if (error < 0 && errno == EBUSY) {
+ error = 0;
+ } else {
+ struct stat dummy;
+ dlog("umount_fs: try stat() before unmount/detach");
+ error = stat(mntdir, &dummy);
+ }
if (!error || (errno == ESTALE || errno == EIO)) {
if (error < 0)
plog(XLOG_INFO, "unmount2_fs: trying unmount/detach of %s (%m)",