[PATCH 0/7] dm/md dependency tree in sysfs (rev.4)



Hello,

This is an updated version of "dm/md dependency tree in sysfs" patch.
For example, if dm-0 maps to sda, we'll have following symlinks;
/sys/block/dm-0/slaves/sda --> /sys/block/sda
/sys/block/sda/holders/dm-0 --> /sys/block/dm-0

Difference from the previous version is a fix for a problem
of calling possibly-sleeping function inside the fast path.
There were 3 such calls in my previous bd_claim patch:
- kmalloc(GFP_KERNEL)
- sysfs_create_symlink()
- sysfs_remove_symlink()
The allocation code is moved outside of locks.
Symlink operations needs to be atomic, so they are moved out
of global bdev_lock and use bdev->bd_sem instead.

Comments are welcome.

I tested this on 2.6.16-rc6 and 2.6.16-rc6-mm1 with both
CONFIG_PREEMPT and CONFIG_DEBUG_SPINLOCK_SLEEP enabled
and saw no warnings in kernel log.

Patches included are:

1. [PATCH 1/7] kobject_add_dir
Adding kobject_add_dir() function which creates
a subdirectory for a given kobject.

2. [PATCH 2/7] add holders/slaves subdirectory to /sys/block
Creating "slaves" and "holders" directories in /sys/block/<disk>,
creating "holders" directory under /sys/block/<disk>/<partition>

3. [PATCH 3/7] bd_claim_by_kobject
Adding bd_claim_by_kobject() function which takes kobject as
additional signature of holder device and creates sysfs symlinks
between holder device and claimed device.
bd_release_from_kobject() is a counter part of bd_claim_by_kobject.

4. [PATCH 4/7] bd_claim_by_disk
Variants which take gendisk instead of kobject
and do kobject_{get,put}(&gendisk->kobj).

5. [PATCH 5/7] md to use bd_claim_by_disk
Use bd_claim_by_disk.

6. [PATCH 6/7] dm to use bd_claim_by_disk
Use bd_claim_by_disk.

7. [PATCH 7/7] conver bd_sem to bd_mutex
bd_sem is converted to bd_mutex in 2.6.16-rc6-mm1.
The patch follows that conversion.

Patch 3 includes the fix mentioned above.

Patch 6 depends on dm-table-store-md.patch and dm-tidy-mdptr.patch
which were committed to -mm yesterday.

Patch 7 depends on sem2mutex-blockdev-2.patch in 2.6.16-rc6-mm1.

Thanks,
--
Jun'ichi Nomura, NEC Solutions (America), Inc.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [OOPS] sysfs_hash_and_remove (was Re: What protection ....)
    ... >> unregistering the kobject in case of bidirectional cross symlinks. ... >> The patch from James, is working, because it is not creating the cross ... references, we can't expect references to get us out of this one, so ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: [PATCH 3/7] dm/md dependency tree in sysfs: bd_claim_by_kobject
    ... Attached patch reflects your comments. ... Adding bd_claim_by_kobject() function which takes kobject as ... additional signature of holder device and creates sysfs symlinks ... * 'struct bd_holder' contains pointers to kobjects symlinked by ...
    (Linux-Kernel)
  • Re: Kubuntus udev broken with 2.6.18-rc2-mm1
    ... I could still follow the bogus symlinks. ... Ick, ok, the problem is that my "virtual device" patch isn't in my ... The point is that these patches break Linux on a major ... release from a major vendor only two years after its release. ...
    (Linux-Kernel)
  • Re: [PATCH] tmpfs symlink corrupts mempolicy
    ... > Andrea discovered that short symlinks on tmpfs, ... > seemed to be an entirely separate patch, ... when the inode is being shrunk. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: [PATCH] [REPOST #2] mm: show node to memory section relationship with symlinks in sysfs
    ... indicates that memory section 135 resides on node1. ... show memory section to node relationship in sysfs" ... Changed from files to symlinks due to feedback that symlinks were ... symlinks in sysfs" patch posted on 29 Sept 2008 to address a Yasunori ...
    (Linux-Kernel)