From: NeilBrown <neilb@suse.de>
To: Al Viro <viro@ZenIV.linux.org.uk>
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 16:55:41 +1100 [thread overview]
Message-ID: <20140313165541.2b23dc96@notabene.brown> (raw)
In-Reply-To: <20140313042934.GM18016@ZenIV.linux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]
On Thu, 13 Mar 2014 04:29:34 +0000 Al Viro <viro@ZenIV.linux.org.uk> wrote:
> 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...
Can we do direct writes from kernel space yet? If so I'll change the code to
do that so that it will work with any filesystem (which supports direct
writes).
(The documentation says we that bitmap files should only be used on ext2 or
ext3. Most people use bitmaps on the raw devices so hopefully the few who
have a need for files will read the documentation :-)
(and yes, I check for FMODE_WRITE)
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2014-03-13 5:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-03 15:16 [PATCH] fs: fix i_writecount on shmem and friends 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
2014-03-13 5:55 ` NeilBrown [this message]
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=20140313165541.2b23dc96@notabene.brown \
--to=neilb@suse.de \
--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=oleg@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).