Re: [PATCH 1/2] btrfs: btrfs_defrag_root() doesn't support any option

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

 



On Wed, Dec 21, 2016 at 03:42:07PM +0800, Anand Jain wrote:
> Both BTRFS_IOC_DEFRAG and BTRFS_IOC_DEFRAG_RANGE call the same
> function- btrfs_ioctl_defrag(), however BTRFS_IOC_DEFRAG does
> not support any argument, so check that and return not supported
> if provided. This has valid impact at the user end, in the cli below
>   btrfs filesystem defrag -clzo /btrfs
> the -c option (or similarly other) is only applicable to the file
> defrag, which is either provided in the argument or when used along
> with the -r option, however as of now the above cli does not report
> any error. This patch will fix it.

I think it would be better to do the sanitization on the userspace side.
In this case combination of a compression option and bare directory
would not lead to the expected result.

IMO it's deciding between

  "pass any arguments to kernel" - here returning EOPNOTSUPP would be
  quite unclear what went wrong

vs.

  "validate as much arguments as we can before passing to kernel" - and
  we'll know early that the combination is not valid, also that we want
  to deprecate it etc.

I vote for #2 as we have enough information to give an informative error
message.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux