Thread (27 messages) 27 messages, 2 authors, 2016-03-22

Re: [PATCH v4 12/13] btrfs: introduce device delete by devid

From: Anand Jain <hidden>
Date: 2016-02-18 06:59:32


On 02/17/2016 06:49 PM, David Sterba wrote:
On Sat, Feb 13, 2016 at 10:01:39AM +0800, Anand Jain wrote:
quoted
+	if (vol_args->flags & BTRFS_DEVICE_BY_ID) {
+		ret = btrfs_rm_device(root, NULL, vol_args->devid);
+	} else {
+		vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
			       BTRFS_SUBVOL_NAME_MAX

Spotted by Chris,

fs/btrfs/ioctl.c:2703: warning: array subscript is above array bounds

my gcc version does not report that. Fixed and for-next pushed.
  mine either. Sorry about that, thanks for the catch.

#define BTRFS_PATH_NAME_MAX 4087
#define BTRFS_SUBVOL_NAME_MAX 4039

  I am fine with using BTRFS_SUBVOL_NAME_MAX for now. But theoretical
  anomaly is that add-device code path will use BTRFS_PATH_NAME_MAX and
  delete device will use BTRFS_SUBVOL_NAME_MAX.. its only theoretical
  as most of the devices path are well below 4k IMO. So its a good
  trade off than other solutions like.. (just for the understanding),

    - Update add device code as well to use btrfs_ioctl_vol_args_v2
      Which means we need to introduce BTRFS_IOC_ADD_DEV_V2 (system
      PATH_MAX is 4096).

    OR

    - Create new btrfs_ioctl_vol_args_v3 with name[BTRFS_PATH_NAME_MAX+1]
    (instead of name[BTRFS_SUBVOL_NAME_MAX+1]) and BTRFS_IOC_RM_DEV_V2
    will be the only consumer of btrfs_ioctl_vol_args_v3 as of now.


Thanks, Anand



Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help