linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH V5 0/2] Btrfs: get/set label of mounted file system
@ 2012-12-17 11:21 Jeff Liu
  2012-12-17 11:22 ` [RFC PATCH V5 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem Jeff Liu
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Jeff Liu @ 2012-12-17 11:21 UTC (permalink / raw)
  To: linux-btrfs; +Cc: anand.jain, miaox

Hello,

This patch set is trying to make Btrfs support get/set label for a mounted file sytem via ioctl(2).
There are a couple of changes according to Miao's comments which were shown as following.

Changes of V5->V4 in kernel:
- Revise the ioctl number of BTRFS_IOC_GET_FSLABEL/BTRFS_IOC_SET_FSLABEL to 49/50 separately.
- Replace btrfs_root_readonly() check up with mnt_want_write_file().
- Validate the input label length, return -EINVAL if the specified length is exceeding
  "BTRFS_LABEL_SIZE -1".

Changes of V5->V4 in user space:
- Revise the ioctl number accordingly.
- Don't proceed to get/set the label upon a mounted file system if the dev patch is specified, i.e.
btrfs filesystem label /dev/sdaX [new label]
  Instead, alert the user to execute this command against the mount point, i.e.
btrfs filesystem label /btrfs_mount_path [new label]
- Validate the input label length for changing the label upon an unmounted file system as well.
  We does not check it up currently, the command just keeping silent and truncate the label
  characters which are beyond "BTRFS_LABEL_SIZE - 1".


Tests:
======
/dev/sda6 on /btrfs type btrfs (rw)

jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs 
btrfs_label

Failure if the length is exceeding 255.
jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs `perl -e 'print "A"x256'`
ERROR: unable to set label Invalid argument

Otherwise, that's ok.
jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs `perl -e 'print "A"x255'`

jeff@koala:~/oss/btrfs-progs$ sudo ./btrfs filesystem label /btrfs
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


The old versions can be found at:
v4:
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/21618

v3:
https://patchwork.kernel.org/patch/1124642/

v2:
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/12877

v1:
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/12872

Thanks,
-Jeff

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-12-18  2:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-17 11:21 [RFC PATCH V5 0/2] Btrfs: get/set label of mounted file system Jeff Liu
2012-12-17 11:22 ` [RFC PATCH V5 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem Jeff Liu
2012-12-17 11:59   ` Miao Xie
2012-12-17 11:22 ` [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system Jeff Liu
2012-12-17 11:57   ` Miao Xie
2012-12-17 13:30     ` Jeff Liu
2012-12-17 17:34       ` Goffredo Baroncelli
2012-12-18  2:20         ` Jeff Liu
2012-12-18  2:21         ` Miao Xie
2012-12-18  2:33           ` Jeff Liu
2012-12-18  2:47             ` Jeff Liu
2012-12-17 11:34 ` [PATCH v5 1/4] Btrfs-progs: get " Jeff Liu
2012-12-17 11:35 ` [PATCH V5 2/4] Btrfs-progs: Change the " Jeff Liu
2012-12-17 11:35 ` [PATCH V5 3/4] Btrfs-progs: Fix set_label_unmounted() with label length validation Jeff Liu
2012-12-17 11:35 ` [PATCH v5 4/4] Btrfs-progs: fix cmd_label_usage to reflect this change Jeff Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).