Re: [PATCH] hfsplus: fix expand when not enough available space

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

 



On Mon, 2015-03-23 at 03:53 +0100, Sergei Antonov wrote:
> HFS+ does not support file size > allocated size, therefore the following
> command should fail:
>  truncate --size=<size exceeding available space> <some file>
> However, it ends successfully. The driver returns success despite having been
> unable to allocate the requested space for the file. Also filesystem check finds
> an error:
>  Checking catalog file.
>  Incorrect size for file test_file
>  (It should be 469094400 instead of 1000000000)
> 
> Add a piece of code analogous to code in the fat driver.
> Now a proper error is returned and filesystem remains consistent.
> 

To be honest, I am not fully understand what is the case of the fix. As
a result, I can understand correctness of the fix. Could you describe
the issue and the fix in more details? Could you provide more clear
description of the use-case of such issue? Anyway, this fix requires in
more clear and detailed description.

Thanks,
Vyacheslav Dubeyko.

> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Vyacheslav Dubeyko <slava@xxxxxxxxxxx>
> Cc: Hin-Tak Leung <htl10@xxxxxxxxxxxxxxxxxxxxx>
> Cc: Anton Altaparmakov <aia21@xxxxxxxxx>
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
> Cc: Sougata Santra <sougata@xxxxxxxxxx>
> Signed-off-by: Sergei Antonov <saproj@xxxxxxxxx>
> ---
>  fs/hfsplus/inode.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
> index 0cf786f..7691cc1 100644
> --- a/fs/hfsplus/inode.c
> +++ b/fs/hfsplus/inode.c
> @@ -254,6 +254,12 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
>  	if ((attr->ia_valid & ATTR_SIZE) &&
>  	    attr->ia_size != i_size_read(inode)) {
>  		inode_dio_wait(inode);
> +		if (attr->ia_size > inode->i_size) {
> +			error = generic_cont_expand_simple(inode,
> +							   attr->ia_size);
> +			if (error)
> +				return error;
> +		}
>  		truncate_setsize(inode, attr->ia_size);
>  		hfsplus_file_truncate(inode);
>  	}


--
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