if (buf)
snprintf(buf, bufsz, _("overlapping loop device exists for %s"), src);
return MNT_EX_FAIL;
+ case -MNT_ERR_LOCK:
+ if (buf)
+ snprintf(buf, bufsz, _("locking failed"));
+ return MNT_EX_FILEIO;
default:
return mnt_context_get_generic_excode(rc, buf, bufsz, _("mount failed: %m"));
}
* mount(2) syscall success, but something else failed
* (probably error in mtab processing).
*/
- if (rc < 0)
+ if (rc == -MNT_ERR_LOCK) {
+ if (buf)
+ snprintf(buf, bufsz, _("filesystem was mounted, but failed to update userspace mount table"));
+ return MNT_EX_FILEIO;
+
+ } else if (rc < 0)
return mnt_context_get_generic_excode(rc, buf, bufsz,
_("filesystem was mounted, but any subsequent operation failed: %m"));
if (buf)
snprintf(buf, bufsz, _("not mounted"));
return MNT_EX_USAGE;
+ } else if (rc == -MNT_ERR_LOCK) {
+ if (buf)
+ snprintf(buf, bufsz, _("locking failed"));
+ return MNT_EX_FILEIO;
}
return mnt_context_get_generic_excode(rc, buf, bufsz,
_("umount failed: %m"));
* umount(2) syscall success, but something else failed
* (probably error in mtab processing).
*/
- if (rc < 0)
+ if (rc == -MNT_ERR_LOCK) {
+ if (buf)
+ snprintf(buf, bufsz, _("filesystem was unmounted, but failed to update userspace mount table"));
+ return MNT_EX_FILEIO;
+
+ } else if (rc < 0)
return mnt_context_get_generic_excode(rc, buf, bufsz,
_("filesystem was unmounted, but any subsequent operation failed: %m"));
* detected overlapping loop device that cannot be re-used
*/
#define MNT_ERR_LOOPOVERLAP 5007
+/**
+ * MNT_ERR_LOCK:
+ *
+ * failed to lock mtab/utab or so.
+ */
+#define MNT_ERR_LOCK 5008
/*
/**
* MNT_EX_FILEIO:
*
- * [u]mount(8) exit code: problems writing, locking, ... mtab/fstab
+ * [u]mount(8) exit code: problems writing, locking, ... mtab/utab
*/
#define MNT_EX_FILEIO 16
if (lc)
rc = mnt_lock_file(lc);
if (rc)
- return rc;
+ return -MNT_ERR_LOCK;
tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
if (lc)
rc = mnt_lock_file(lc);
if (rc)
- return rc;
+ return -MNT_ERR_LOCK;
tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
if (lc)
rc = mnt_lock_file(lc);
if (rc)
- return rc;
+ return -MNT_ERR_LOCK;
tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
if (lc)
rc = mnt_lock_file(lc);
if (rc)
- return rc;
+ return -MNT_ERR_LOCK;
tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);
}
if (lc && upd->userspace_only)
mnt_lock_use_simplelock(lc, TRUE); /* use flock */
- if (lc)
+ if (lc) {
rc = mnt_lock_file(lc);
- if (rc)
- goto done;
+ if (rc) {
+ rc = -MNT_ERR_LOCK;
+ goto done;
+ }
+ }
tb = __mnt_new_table_from_file(upd->filename,
upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB);