From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Open the target device with O_EXCL
Date: Tue, 5 Apr 2016 10:14:27 -0400 (EDT) [thread overview]
Message-ID: <2126126528.47807026.1459865667265.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1459865009-14109-2-git-send-email-anprice@redhat.com>
----- Original Message -----
> O_EXCL will let local mounters know that the device is busy while
> mkfs.gfs2 is running so that they don't try to access it.
>
> Before:
> # mount /dev/vdc /mnt/test
> mount: /dev/vdc: can't read superblock
>
> With O_EXCL:
> # mount /dev/vdc /mnt/test
> mount: /dev/vdc is already mounted or /mnt/test busy
>
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
> gfs2/mkfs/main_mkfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
> index 107d3cc..4436f93 100644
> --- a/gfs2/mkfs/main_mkfs.c
> +++ b/gfs2/mkfs/main_mkfs.c
> @@ -854,7 +854,7 @@ static void open_dev(struct mkfs_dev *dev)
> {
> int error;
>
> - dev->fd = open(dev->path, O_RDWR | O_CLOEXEC);
> + dev->fd = open(dev->path, O_RDWR|O_CLOEXEC|O_EXCL);
> if (dev->fd < 0) {
> perror(dev->path);
> exit(1);
> --
> 2.4.11
>
>
Hi Andy,
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.
Regards,
Bob Peterson
Red Hat File Systems
next prev parent reply other threads:[~2016-04-05 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 14:03 [Cluster-devel] [PATCH 1/2] gfs2_edit: Don't hijack bh->b_data in read_master_dir Andrew Price
2016-04-05 14:03 ` [Cluster-devel] [PATCH 2/2] mkfs.gfs2: Open the target device with O_EXCL Andrew Price
2016-04-05 14:14 ` Bob Peterson [this message]
2016-04-05 14:37 ` Andrew Price
2016-04-05 17:09 ` Bob Peterson
2016-04-05 17:11 ` [Cluster-devel] [PATCH 1/2] gfs2_edit: Don't hijack bh->b_data in read_master_dir Bob Peterson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2126126528.47807026.1459865667265.JavaMail.zimbra@redhat.com \
--to=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.