27 Jan, 2016
1 commit
-
If the mount phase is not finished, we can't update the sysfs files.
Reported-by: Chris Mason
Signed-off-by: David Sterba
Signed-off-by: Chris Mason
22 Jan, 2016
2 commits
-
The files under /sys/fs/UUID/features get out of sync with the actual
incompat bits set for the filesystem if they change after mount. We're
going to sync them and need a helper to do that.Signed-off-by: David Sterba
-
The incompat bit representing the newly added free space tree feature is
missing. Right now it will be listed only among features supported by
the module, not per-fs.Signed-off-by: David Sterba
29 Sep, 2015
5 commits
-
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba
22 Jun, 2015
1 commit
-
Signed-off-by: Anand Jain
Tested-by: David Sterba
Signed-off-by: David Sterba
27 May, 2015
18 commits
-
To support seed sysfs layout and represent seed fsid under
the sprout we need the facility to create fsid under the
specified parent.Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
since btrfs_kobj_rm_device() does nothing with fs_info
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
btrfs_kobj_add_device() does not need fs_info any more.
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Just a helper function to clean up the sysfs fsid kobjects.
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
adds fs_info pointer with struct btrfs_fs_devices.
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
This patch will provide a framework and help to create attributes
from the structure btrfs_fs_devices which are available even before
fs_info is created. So by moving the parent kobject super_kobj from
fs_info to btrfs_fs_devices, it will help to create attributes
from the btrfs_fs_devices as well.Patches on top of this patch now will be able to create the
sys/fs/btrfs/fsid kobject and attributes from btrfs_fs_devices
when devices are scanned and registered to the kernel.Just to note, this does not change any of the existing btrfs sysfs
external kobject names and its attributes and not even the life
cycle of them. Changes are internal only. And to ensure the same,
this path has been tested with various device operations and,
checking and comparing the sysfs kobjects and attributes with
sysfs kobject and attributes with out this patch, and they remain
same.Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Separate device kobject and its attribute creation so that device
kobject can be created from the device discovery thread.Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
As of now btrfs_attrs are provided using the default_attrs through
the kset. Separate them and create the default_attrs using the
sysfs_create_files instead. By doing this we will have the
flexibility that device discovery thread could create fsid
kobject.Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
We need it in a seperate function so that it can be called from the
device discovery thread as well.Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
As of now the order in which the kobjects are created
at btrfs_sysfs_add_one() is..
fsid
features
unknown features (dynamic features)
devices.Since we would move fsid and device kobject to fs_devices
from fs_info structure, this patch will reorder in which
the kobjects are created as below.
fsid
devices
features
unknown features (dynamic features)And hence the btrfs_sysfs_remove_one() will follow the same
in reverse order. and the device kobject destroy now can
be moved into the function __btrfs_sysfs_remove_one()Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Since the failure code in the btrfs_sysfs_add_one() can
call btrfs_sysfs_remove_one() even before device_dir_kobj
has been created we need to check if its null.Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
The sysfs clean up self test like in the below code fails, since
fs_info->device_dir_kobject still points to its stale kobject.
Reseting this pointer will help to fix this.open_ctree()
{ret = btrfs_sysfs_add_one(fs_info);
::
+ btrfs_sysfs_remove_one(fs_info);
+ ret = btrfs_sysfs_add_one(fs_info);
+ if (ret) {
+ pr_err("BTRFS: failed to init sysfs interface: %d\n", ret);
+ goto fail_block_groups;
+ }Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
Theoritically need to remove the device links attributes, but since its entire device
kobject was removed, so there wasn't any issue of about it. Just do it nicely.Signed-off-by: Anand Jain
Signed-off-by: David Sterba -
The following test case fails indicating that, thread tried to init an initialized object.
kernel: [232104.016513] kobject (ffff880006c1c980): tried to init an initialized object, something is seriously wrong.
btrfs_sysfs_remove_one() self test code:
open_tree()
{
::
ret = btrfs_sysfs_add_one(fs_info);
if (ret) {
pr_err("BTRFS: failed to init sysfs interface: %d\n", ret);
goto fail_block_groups;
}
+ btrfs_sysfs_remove_one(fs_info);
+ ret = btrfs_sysfs_add_one(fs_info);
+ if (ret) {
+ pr_err("BTRFS: failed to init sysfs interface: %d\n", ret);
+ goto fail_block_groups;
+ }cleaning up the unregistered kobject fixes this.
Signed-off-by: Anand Jain
Signed-off-by: David Sterba
17 Feb, 2015
1 commit
-
There are some op tables that can be easily made const, similarly the
sysfs feature and raid tables. This is motivated by PaX CONSTIFY plugin.Signed-off-by: David Sterba
03 Feb, 2015
1 commit
-
If we failed during initialization of sysfs, we weren't unregistering the
top level btrfs sysfs entry nor the debugfs stuff.
Not unregistering the top level sysfs entry makes future attempts to reload
the btrfs module impossible and the following is reported in dmesg:[ 2246.451296] WARNING: CPU: 3 PID: 10999 at fs/sysfs/dir.c:486 sysfs_warn_dup+0x91/0xb0()
[ 2246.451298] sysfs: cannot create duplicate filename '/fs/btrfs'
[ 2246.451298] Modules linked in: btrfs(+) raid6_pq xor bnep rfcomm bluetooth binfmt_misc nfsd auth_rpcgss oid_registry nfs_acl nfs lockd fscache sunrpc parport_pc parport psmouse serio_raw pcspkr evbug i2c_piix4 e1000 floppy [last unloaded: btrfs]
[ 2246.451310] CPU: 3 PID: 10999 Comm: modprobe Tainted: G W 3.13.0-fdm-btrfs-next-24+ #7
[ 2246.451311] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 2246.451312] 0000000000000009 ffff8800d353fa08 ffffffff816f1da6 0000000000000410
[ 2246.451314] ffff8800d353fa58 ffff8800d353fa48 ffffffff8104a32c ffff88020821a290
[ 2246.451316] ffff88020821a290 ffff88020821a290 ffff8802148f0000 ffff8800d353fb80
[ 2246.451318] Call Trace:
[ 2246.451322] [] dump_stack+0x4e/0x68
[ 2246.451324] [] warn_slowpath_common+0x8c/0xc0
[ 2246.451325] [] warn_slowpath_fmt+0x46/0x50
[ 2246.451328] [] ? strlcat+0x65/0x90
(....)This fixes the following change:
btrfs: add simple debugfs interface
commit 1bae30982bc86ab66d61ccb6e22792593b45d44dSigned-off-by: Filipe Manana
Signed-off-by: Chris Mason
12 Nov, 2014
2 commits
-
Signed-off-by: David Sterba
-
Signed-off-by: David Sterba
18 Sep, 2014
5 commits
-
Not sure how this escaped many eyes so far
Signed-off-by: Anand Jain
Signed-off-by: Chris Mason -
BTRFS_ATTR_RW could set the mode and be inline with BTRFS_ATTR
Signed-off-by: Anand Jain
Signed-off-by: Chris Mason -
All that uses BTRFS_ATTR want mode to be set at 0444 so just do
it at the define. And few spacing alignments.Signed-off-by: Anand Jain
Signed-off-by: Chris Mason -
we have BTRFS_ATTR define to create sysfs RO file, use that.
Signed-off-by: Anand Jain
Signed-off-by: Chris Mason -
Rediffed remaining parts of original patch from Anand Jain. This makes
sure to avoid trailing newlines in the btrfs label outputreproducer.sh:
===============================================================================
TEST_DEV=/dev/vdb
TEST_DIR=/home/sat/mntumount /home/sat/mnt
mkfs.btrfs -f $TEST_DEV
UUID=$(btrfs fi show $TEST_DEV | head -1 | sed -e 's/.*uuid: \([-0-9a-z]*\)$/\1/')
mount $TEST_DEV $TEST_DIR
LABELFILE=/sys/fs/btrfs/$UUID/labelecho "Test for empty label..." >&2
LINES="$(cat $LABELFILE | wc -l | awk '{print $1}')"
RET=0if [ $LINES -eq 0 ] ; then
echo '[PASS] Trailing \n is removed correctly.' >&2
else
echo '[FAIL] Trailing \n still exists.' >&2
RET=1
fiecho "Test for non-empty label..." >&2
echo testlabel >$LABELFILE
LINES="$(cat $LABELFILE | wc -l | awk '{print $1}')"if [ $LINES -eq 1 ] ; then
echo '[PASS] Trailing \n is removed correctly.' >&2
else
echo '[FAIL] Trailing \n still exists.' >&2
RET=1
fiexit $RET
===============================================================================Signed-off-by: Satoru Takeuchi
Signed-off-by: Chris Mason
21 Aug, 2014
1 commit
-
Commit 49c6f736f34f901117c20960ebd7d5e60f12fcac(
btrfs: dev replace should replace the sysfs entry) added the missing sysfs entry
in the process of device replace, but didn't take missing devices into account,
so now we haveBUG: unable to handle kernel NULL pointer dereference at 0000000000000088
IP: [] btrfs_kobj_rm_device+0x21/0x40 [btrfs]
...To reproduce it,
1. mkfs.btrfs -f disk1 disk2
2. mkfs.ext4 disk1
3. mount disk2 /mnt -odegraded
4. btrfs replace start -B 1 disk3 /mnt
--------------------------This fixes the problem.
Reported-by: Chris Murphy
Signed-off-by: Liu Bo
Reviewed-by: Satoru Takeuchi
Tested-by: Satoru Takeuchi
Signed-off-by: Chris Mason
29 Jun, 2014
3 commits
-
we would need the device links to be created,
when device is added.Signed-off-by: Anand Jain
Reviewed-by: David Sterba
Signed-off-by: Chris Mason -
when we delete the device from the mounted btrfs,
we would need its corresponding sysfs enty to
be removed as well.Signed-off-by: Anand Jain
Reviewed-by: David Sterba
Signed-off-by: Chris Mason -
Signed-off-by: Anand Jain
Reviewed-by: David Sterba
Signed-off-by: Chris Mason