mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: NeilBrown <neilb@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	David Herrmann <dh.herrmann@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH] fs: fix i_writecount on shmem and friends
Date: Thu, 13 Mar 2014 04:29:34 +0000	[thread overview]
Message-ID: <20140313042934.GM18016@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20140313150800.07878c80@notabene.brown>

On Thu, Mar 13, 2014 at 03:08:00PM +1100, NeilBrown wrote:
> +		inode = mddev->bitmap_info.file->f_mapping->host;
> +		if (!S_ISREG(inode->i_mode)) {
> +			printk(KERN_ERR "%s: error: bitmap file must be a regular file\n",
> +			       mdname(mddev));
> +			fput(mddev->bitmap_info.file);
> +			mddev->bitmap_info.file = NULL;
> +			return -EBADF;
> +		}
> +		if (atomic_read(&inode->i_writecount) != 1) {

Umm...  I think you ought to check more than that.  At the very least you
want to check that you have it opened for write - you don't want e.g.
a filesystem containing that puppy remounted r/o under you.  Another thing
is, what happens if it's not a buffer cache backed one?  Hell, what happens
if it's a file on NFS?  You are relying on bmap() working, right?  So it
looks like you ought to check if ->bmap() is there.  And I really wonder
how well does it play with journalling fs...

  reply	other threads:[~2014-03-13  4:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-03 15:16 David Herrmann
2014-03-11 19:05 ` Linus Torvalds
2014-03-12 18:19   ` Al Viro
2014-03-12 22:30     ` David Herrmann
2014-03-13  0:37       ` Al Viro
2014-03-13 11:03         ` David Herrmann
2014-03-20 11:13         ` David Herrmann
2014-03-13  4:08     ` NeilBrown
2014-03-13  4:29       ` Al Viro [this message]
2014-03-13  5:55         ` NeilBrown
2014-03-14  4:51           ` Al Viro

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=20140313042934.GM18016@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=dh.herrmann@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=oleg@redhat.com \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome