diff options
author | Karel Zak | 2013-11-04 12:45:33 +0100 |
---|---|---|
committer | Karel Zak | 2013-11-04 14:24:41 +0100 |
commit | 7e0c06194f5e65eb2a9ae38515d78f4ef301c809 (patch) | |
tree | 9016b997f030a5f288ed7a5b48b399c5e80624ef /libmount/src/context.c | |
parent | libmount: allow to use -s (sloppy) for all external helpers (diff) | |
download | kernel-qcow2-util-linux-7e0c06194f5e65eb2a9ae38515d78f4ef301c809.tar.gz kernel-qcow2-util-linux-7e0c06194f5e65eb2a9ae38515d78f4ef301c809.tar.xz kernel-qcow2-util-linux-7e0c06194f5e65eb2a9ae38515d78f4ef301c809.zip |
libmount: update utab after successful extern helper mount
This patch allows to maintain private utab libmount file also for
external mount/umount helpers that are not linked with libmount.
The libmount check if utab has been updated after successful extern
helper execution (status=0). If not then the file is updated.
This patch affects only 'user' fstab mount option. So, for example
with suid mount.cifs you can use:
//server/foo /mnt cifs username=foo,noauto,user
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context.c')
-rw-r--r-- | libmount/src/context.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/libmount/src/context.c b/libmount/src/context.c index 5a88bcdcc..2ef3d3001 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -1725,10 +1725,6 @@ int mnt_context_prepare_update(struct libmnt_context *cxt) DBG(CXT, mnt_debug_h(cxt, "skip update: NOMTAB flag")); return 0; } - if (cxt->helper) { - DBG(CXT, mnt_debug_h(cxt, "skip update: external helper")); - return 0; - } if (!cxt->mtab_writable && !cxt->utab_writable) { DBG(CXT, mnt_debug_h(cxt, "skip update: no writable destination")); return 0; @@ -1777,16 +1773,30 @@ int mnt_context_update_tabs(struct libmnt_context *cxt) DBG(CXT, mnt_debug_h(cxt, "don't update: NOMTAB flag")); return 0; } - if (cxt->helper) { - DBG(CXT, mnt_debug_h(cxt, "don't update: external helper")); - return 0; - } if (!cxt->update || !mnt_update_is_ready(cxt->update)) { DBG(CXT, mnt_debug_h(cxt, "don't update: no update prepared")); return 0; } - if (cxt->syscall_status) { - DBG(CXT, mnt_debug_h(cxt, "don't update: syscall failed/not called")); + + /* check utab update when external helper executed */ + if (mnt_context_helper_executed(cxt) + && mnt_context_get_helper_status(cxt) == 0 + && cxt->utab_writable) { + + if (mnt_update_already_done(cxt->update, cxt->lock)) { + DBG(CXT, mnt_debug_h(cxt, "don't update: error evaluate or already updated")); + return 0; + } + } else if (cxt->helper) { + DBG(CXT, mnt_debug_h(cxt, "don't update: external helper")); + return 0; + } + + if (cxt->syscall_status != 0 + && !(mnt_context_helper_executed(cxt) && + mnt_context_get_helper_status(cxt) == 0)) { + + DBG(CXT, mnt_debug_h(cxt, "don't update: syscall/helper failed/not called")); return 0; } |