All of lore.kernel.org
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: tj <tj@kernel.org>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: What's the mean of FMODE_EXCL?
Date: Wed, 21 Nov 2012 20:08:23 +0800	[thread overview]
Message-ID: <201211212008205646854@gmail.com> (raw)

Hi all:
	Today, i wrote to a partition which already mounted using dd.So the fs was destroyed completedly.
So i asked why dd can write? I remembed the flag O_EXCL which prevent other operation.
I review the code and found it used FMODE_EXCL.But why dd can write?
In open(2):
>             In  general,  the  behavior  of  O_EXCL is undefined if it is used without O_CREAT.  There is one
>             exception: on Linux 2.6 and later, O_EXCL can be used without O_CREAT if  pathname  refers  to  a
>              block device.  If the block device is in use by the system (e.g., mounted), open() fails with the
>              error EBUSY.
 But understand from the literal meaning, EXCL means opened exclusively.I think it like mutex-operation.
Can someone please tell me why?

Thanks!
Jianpeng

                 reply	other threads:[~2012-11-21 12:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=201211212008205646854@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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.