Bug 624987 - bindings file might be overwritten
bindings file might be overwritten
Status: CLOSED INSUFFICIENT_DATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: device-mapper-multipath (Show other bugs)
5.5
All Linux
low Severity medium
: rc
: ---
Assigned To: Ben Marzinski
Storage QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-18 06:12 EDT by Bernd Schubert
Modified: 2014-02-06 12:14 EST (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-02-06 12:14:07 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Bernd Schubert 2010-08-18 06:12:42 EDT
A possible solution for bug 624985, which I also just filled for device-mapper-multipath is to add our custom aliases to the bindings file. However, a collegue immediately complained that he observed the binding file got overwritten in the past. So checked the code and open_bindings_file() opens the file with 

        fd = open(file, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);

I suggest to add O_APPEND here.
Comment 1 Ben Marzinski 2010-08-19 17:31:25 EDT
Can you recreate this?  multipath does a seek immediately before it writes to the bindings file.  It also locks the bindings file with a fcntl lock, so that no other multipath thread can write to the bindings file while it is doing this. Admittedly, this doesn't prevent a user who is hand editting the file from messing with it, but there is a warning against that at the top of the bindings file, and there is no way to prevent the much more likely problem here, where the user simply saves over a bindings file that got modified after they started editting it.

I'm not strongly against having O_APPEND here, since multipath always wants to be writing to the end of the file, but without a reproducer, it doesn't appear that this will actually fix a bug.  I'm not saying that there isn't a bug that can cause the bindings file to get corrupted, but it doesn't appear that O_APPEND will change this. Unless you can actually see this issue, I suggest that this bug be moved to fedora.
Comment 2 Bernd Schubert 2010-08-20 10:13:13 EDT
No sorry, I cannot reproduce. As I said, I internally suggested to workaround bug 624985 by using the bindings file and then a colleagure intervented and so I went ahead and quickly checked the code...
We probably also need to check when exactly multipathd opens the file. If the file is open all the time, it might easily race. I have not check yet what it will do before it writes.
Comment 3 RHEL Product and Program Management 2014-01-29 05:38:35 EST
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

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