Re: [PATCH] fs: fix i_writecount on shmem and friends

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux