Bug 143118 - (IT_52656) am-utils and autofs use different mtab locking
am-utils and autofs use different mtab locking
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: am-utils (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Petr Rockai
Jay Turner
:
: 154108 (view as bug list)
Depends On:
Blocks: 156320 156322
  Show dependency treegraph
 
Reported: 2004-12-16 12:32 EST by Bastien Nocera
Modified: 2015-01-07 19:09 EST (History)
10 users (show)

See Also:
Fixed In Version: RHBA-2005-669
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-05 12:49:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
am-utils-mtab-lock.patch (15.01 KB, patch)
2004-12-16 12:34 EST, Bastien Nocera
no flags Details | Diff
am-utils-mtab-lock-symlink.patch (448 bytes, patch)
2004-12-16 12:36 EST, Bastien Nocera
no flags Details | Diff
Bring the am-utils patches inline with the patch for mount (4.36 KB, patch)
2005-02-24 12:06 EST, Daniel Berrange
no flags Details | Diff
The am-utils source RPM with all patches applied (1.41 MB, application/x-rpm)
2005-02-24 12:09 EST, Daniel Berrange
no flags Details
The correspondingly patched util-linux RPM that i tested (1.48 MB, application/x-rpm)
2005-02-24 12:11 EST, Daniel Berrange
no flags Details
Modified berrange@redhat.com testcase. I can acknowledge the testcase works. (6.55 KB, application/x-gzip)
2005-08-18 11:07 EDT, Peter Vrabec
no flags Details

  None (edit)
Description Bastien Nocera 2004-12-16 12:32:39 EST
The BSD automounter in 'am-utils' has hand-crafted its own code for
mounting file systems & updating /etc/mtab. In this code it uses
flock() to take out an exclusive lock on /etc/mtab. The Linux native
automounter (AutoFS4) merely invokes /bin/mount to perform actuall
mount & update /etc/mtab. The /bin/mount program uses fcntl() to take
out an exclusive lock on /etc/mtab.

The result of this is that if you run both AMD and AutoFS4 on the same
machine, then if you happen to be unlucky enough to have a mount point
created / expired in AMD & AutoFS4 managaged locations at the same
time, your /etc/mtab will become corrupted.

Patches below fix this issue.
Comment 1 Bastien Nocera 2004-12-16 12:34:59 EST
Created attachment 108723 [details]
am-utils-mtab-lock.patch

Patch by Daniel Berrange <berrange@redhat.com>:

I'm attaching a patch which adds a new mtab handling code specifically for
Linux. This is taken from the /bin/mount source code so is 100% in sync with
the locking scheme used there. As an added benefit it also fixes am-utils
handling of symlinks on /etc/mtab (ie it'll not try updating mtab, if it is a
symlink). In terms of impl, the conf/mtab/mtab_linux.c file basically started
off as a copy of conf/mtab/mtab_file.c, and then I merely replaced any code
relating to locking, so the actual updating code didn't change.
Comment 2 Bastien Nocera 2004-12-16 12:36:01 EST
Created attachment 108724 [details]
am-utils-mtab-lock-symlink.patch

Patch by Daniel Berrange <berrange@redhat.com> again:

The first patch had a bug whereby it was still take out an exclusive lock on
/etc/mtab~ when it was a symlink, even though it would never update it. The
attached patch augments the first, preventing it from doing any locking at all
when symlinks are involved.
Comment 13 Daniel Berrange 2005-02-24 12:06:14 EST
Created attachment 111384 [details]
Bring the am-utils patches inline with the patch for mount

This patch should be applied after the	am-utils-mtab-lock &
am-utils-mtab-lock-symlink patches. The endd result is to bring am-utils inline
with the locking scheme for /etc/fstab implemented in the patch 111141 for
util-linux
Comment 14 Daniel Berrange 2005-02-24 12:09:40 EST
Created attachment 111386 [details]
The am-utils source RPM with all patches applied
Comment 15 Daniel Berrange 2005-02-24 12:11:52 EST
Created attachment 111387 [details]
The correspondingly patched util-linux RPM that i tested
Comment 21 Petr Rockai 2005-03-22 08:58:18 EST
Uhm, pvrabec fell out of the CC list, apparently. 
 
@pvrabec: i suggest you read the (back)log for the bug and apply the patches 
where appropriate, as kzak suggested. 
Comment 38 Karel Zak 2005-07-28 12:41:46 EDT
*** Bug 154108 has been marked as a duplicate of this bug. ***
Comment 49 Peter Vrabec 2005-08-18 11:07:19 EDT
Created attachment 117871 [details]
Modified berrange@redhat.com testcase. I can  acknowledge the testcase works.
Comment 58 Red Hat Bugzilla 2005-09-28 11:50:37 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-626.html
Comment 59 Red Hat Bugzilla 2005-10-05 09:35:36 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-341.html
Comment 60 Red Hat Bugzilla 2005-10-05 12:49:46 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-669.html

Note You need to log in before you can comment on or make changes to this bug.