From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Price Date: Tue, 5 Apr 2016 15:37:28 +0100 Subject: [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Open the target device with O_EXCL In-Reply-To: <2126126528.47807026.1459865667265.JavaMail.zimbra@redhat.com> References: <1459865009-14109-1-git-send-email-anprice@redhat.com> <1459865009-14109-2-git-send-email-anprice@redhat.com> <2126126528.47807026.1459865667265.JavaMail.zimbra@redhat.com> Message-ID: <5703CDA8.2090705@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 05/04/16 15:14, Bob Peterson wrote: > In fact, we used to have O_EXCL: > > https://git.fedorahosted.org/cgit/cluster.git/commit/gfs2/mkfs/main_mkfs.c?h=RHEL6&id=b0db0bad3e6a8996fcaecbb93bfe9f8de97b7508 > > I remember Ryan doing this, but I'm not sure why or how it disappeared. > We need to chase down why O_EXCL was removed last time; whether it was just > an oversight/mistake or whether it caused problems elsewhere. That check_mount() function opened the device to check whether it was mounted and then closed it again, leaving main() to open it again afterwards for writing. From the commit history it looks like the function was just removed because it was racey, nothing related to the use of O_EXCL specifically, so I don't think there's anything in the history to suggest that it's a bad idea. Cheers, Andy