Bug 143118 (IT_52656)

Summary: am-utils and autofs use different mtab locking
Product: Red Hat Enterprise Linux 3 Reporter: Bastien Nocera <bnocera>
Component: am-utilsAssignee: Petr Rockai <prockai>
Status: CLOSED ERRATA QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: bbrock, benl, berrange, jnovy, kzak, laroche, prockai, pvrabec, srevivo, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2005-669 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-05 16:49:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 156320, 156322    
Attachments:
Description Flags
am-utils-mtab-lock.patch
none
am-utils-mtab-lock-symlink.patch
none
Bring the am-utils patches inline with the patch for mount
none
The am-utils source RPM with all patches applied
none
The correspondingly patched util-linux RPM that i tested
none
Modified berrange@redhat.com testcase. I can acknowledge the testcase works. none

Description Bastien Nocera 2004-12-16 17:32:39 UTC
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 17:34:59 UTC
Created attachment 108723 [details]
am-utils-mtab-lock.patch

Patch by Daniel Berrange <berrange>:

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 17:36:01 UTC
Created attachment 108724 [details]
am-utils-mtab-lock-symlink.patch

Patch by Daniel Berrange <berrange> 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 Berrangé 2005-02-24 17:06:14 UTC
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 Berrangé 2005-02-24 17:09:40 UTC
Created attachment 111386 [details]
The am-utils source RPM with all patches applied

Comment 15 Daniel Berrangé 2005-02-24 17:11:52 UTC
Created attachment 111387 [details]
The correspondingly patched util-linux RPM that i tested

Comment 21 Petr Rockai 2005-03-22 13:58:18 UTC
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 16:41:46 UTC
*** Bug 154108 has been marked as a duplicate of this bug. ***

Comment 49 Peter Vrabec 2005-08-18 15:07:19 UTC
Created attachment 117871 [details]
Modified berrange testcase. I can  acknowledge the testcase works.

Comment 58 Red Hat Bugzilla 2005-09-28 15:50:37 UTC
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 13:35:36 UTC
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 16:49:46 UTC
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