All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Drebes <lists-receive@programmierforen.de>
To: Chris Mason <chris.mason@oracle.com>
Cc: Christoph Hellwig <hch@infradead.org>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Prevent btrfsck to run on mounted filesystems
Date: Mon, 9 Nov 2009 15:59:06 +0100	[thread overview]
Message-ID: <200911091559.06478.lists-receive@programmierforen.de> (raw)
In-Reply-To: <200910312146.21384.lists-receive@programmierforen.de>

Hi!

> > In this case O_EXCL is going to be more accurate just because the
> > mounted check doesn't cover every disk in the FS.  For now btrfsck
> > doesn't really give consistent results even readonly on a mounted
> > filesystem.  We should prevent it with a message just to prevent
> > confusion.
> Thanks for the reply. I'll do this as soon as I understand the code
> that is affected by those changes (I'm still in the learning phase
> and stepping through the code).   

OK, I've stepped through the code so far and I think I now have an idea of what should be changed. However, concerning the solution, I was confusing two things.

Christoph Hellwig earlier wrote:
> Just open the nodes with O_EXCL and you'll get all the checking for
> free.
I thought that open() with O_EXCL would fail if the file is already opened RW somewhere else. But the man page for open() says something else:

"O_EXCL: Ensure that this call creates the file: if this flag  is  specified  in  conjunction with O_CREAT, and pathname already exists, then open() will fail."

And especially:

"The behavior of O_EXCL is  undefined if O_CREAT is not specified."

After having read this, I don't see how this can help to prevent btrfsck to open a device that is mounted. What am I getting wrong? Currently, I would do the same check as in the original patch, but in btrfs_open_devices() instead of main().

	Cheers,
		Andi

      reply	other threads:[~2009-11-09 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 20:52 [PATCH] Prevent btrfsck to run on mounted filesystems Andi Drebes
2009-10-30  5:02 ` Christoph Hellwig
2009-10-30 13:05   ` Chris Mason
2009-10-31 20:46     ` Andi Drebes
2009-11-09 14:59       ` Andi Drebes [this message]

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=200911091559.06478.lists-receive@programmierforen.de \
    --to=lists-receive@programmierforen.de \
    --cc=chris.mason@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-btrfs@vger.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.