Message ID | 1404265052-29424-1-git-send-email-Anand.Jain@oracle.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
(2014/07/02 10:37), Anand Jain wrote: > when we add a new disk to the mounted btrfs we don't record it > as of now, disk add is a critical change of btrfs configuration, > it must be recorded in the syslog to help offline investigations > of customer problems when reported. > > Signed-off-by: Anand Jain <Anand.Jain@oracle.com> > Reviewed-by: David Sterba <dsterba@suse.cz> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> test result: 3.16-rc3: failed 3.16-rc3 with this patch: success =============================================================================== #!/bin/sh TEST_DEV1=/dev/vdb TEST_DEV2=/dev/vdc TEST_MNT=/home/sat/mnt umount $TEST_MNT mkfs.btrfs -f $TEST_DEV1 dmesg >dmesg.old mount $TEST_DEV1 $TEST_MNT btrfs dev add -f $TEST_DEV2 $TEST_MNT if [ $? -ne 0 ] ; then echo "[ERROR] failed to btrfs dev add." >&2 exit 1 fi btrfs dev del $TEST_DEV2 $TEST_MNT if [ $? -ne 0 ] ; then echo "[ERROR] failed to btrfs dev delete" >&2 exit 1 fi dmesg >dmesg.new diff dmesg.old dmesg.new | grep '^>' >dmesg.diff RET=0 TEST_DEV1_BASE=$(basename $TEST_DEV1) if grep -q "BTRFS info (device $TEST_DEV1_BASE): device added $TEST_DEV2" dmesg.diff ; then echo "[PASS] btrfs device add is logged." >&2 else echo "[FAIL] btrfs device add is not logged." >&2 RET=1 fi if grep -q "BTRFS info (device $TEST_DEV1_BASE): device deleted $TEST_DEV2" dmesg.diff ; then echo "[PASS] btrfs device delete is logged." >&2 else echo "[FAIL] btrfs device delete is not logged." >&2 RET=1 fi rm dmesg.{new,old,diff} umount $TEST_MNT exit $RET =============================================================================== Thanks, Satoru > --- > v2: Accepts David's review comment, thanks > > fs/btrfs/ioctl.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c > index 86d5474..4e10259 100644 > --- a/fs/btrfs/ioctl.c > +++ b/fs/btrfs/ioctl.c > @@ -2488,6 +2488,10 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) > vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; > ret = btrfs_init_new_device(root, vol_args->name); > > + if (!ret) > + btrfs_info(root->fs_info, "device added %s", > + vol_args->name); > + > kfree(vol_args); > out: > mutex_unlock(&root->fs_info->volume_mutex); > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
(2014/07/02 16:02), Satoru Takeuchi wrote: > (2014/07/02 10:37), Anand Jain wrote: >> when we add a new disk to the mounted btrfs we don't record it >> as of now, disk add is a critical change of btrfs configuration, >> it must be recorded in the syslog to help offline investigations >> of customer problems when reported. >> >> Signed-off-by: Anand Jain <Anand.Jain@oracle.com> >> Reviewed-by: David Sterba <dsterba@suse.cz> > > Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> > Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> > > test result: > 3.16-rc3: failed > 3.16-rc3 with this patch: success Please let me correct. > > =============================================================================== > #!/bin/sh > > TEST_DEV1=/dev/vdb > TEST_DEV2=/dev/vdc > TEST_MNT=/home/sat/mnt > > umount $TEST_MNT > mkfs.btrfs -f $TEST_DEV1 > dmesg >dmesg.old > > mount $TEST_DEV1 $TEST_MNT > btrfs dev add -f $TEST_DEV2 $TEST_MNT > if [ $? -ne 0 ] ; then > echo "[ERROR] failed to btrfs dev add." >&2 > exit 1 > fi > > btrfs dev del $TEST_DEV2 $TEST_MNT > if [ $? -ne 0 ] ; then > echo "[ERROR] failed to btrfs dev delete" >&2 > exit 1 > fi > > dmesg >dmesg.new > diff dmesg.old dmesg.new | grep '^>' >dmesg.diff > > RET=0 > TEST_DEV1_BASE=$(basename $TEST_DEV1) > if grep -q "BTRFS info (device $TEST_DEV1_BASE): device added $TEST_DEV2" dmesg.diff ; then > echo "[PASS] btrfs device add is logged." >&2 > else > echo "[FAIL] btrfs device add is not logged." >&2 > RET=1 > fi [PASS] here, > > if grep -q "BTRFS info (device $TEST_DEV1_BASE): device deleted $TEST_DEV2" dmesg.diff ; then > echo "[PASS] btrfs device delete is logged." >&2 > else > echo "[FAIL] btrfs device delete is not logged." >&2 > RET=1 > fi And [FAIL] here since 2/2 is not applied yet at this test. Thanks, Satoru > > rm dmesg.{new,old,diff} > umount $TEST_MNT > > exit $RET > =============================================================================== > > Thanks, > Satoru > >> --- >> v2: Accepts David's review comment, thanks >> >> fs/btrfs/ioctl.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c >> index 86d5474..4e10259 100644 >> --- a/fs/btrfs/ioctl.c >> +++ b/fs/btrfs/ioctl.c >> @@ -2488,6 +2488,10 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) >> vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; >> ret = btrfs_init_new_device(root, vol_args->name); >> >> + if (!ret) >> + btrfs_info(root->fs_info, "device added %s", >> + vol_args->name); >> + >> kfree(vol_args); >> out: >> mutex_unlock(&root->fs_info->volume_mutex); >> > > -- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 86d5474..4e10259 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2488,6 +2488,10 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; ret = btrfs_init_new_device(root, vol_args->name); + if (!ret) + btrfs_info(root->fs_info, "device added %s", + vol_args->name); + kfree(vol_args); out: mutex_unlock(&root->fs_info->volume_mutex);