lkml.org 
[lkml]   [2008]   [Mar]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSun, 2 Mar 2008 15:10:35 +0800
From"Peter Teoh" <>
SubjectUnmatched semaphore usage in fs/super.c
Please pardon me if wrong.   In fs/super.c, I saw a down_read()
without a matching (when sb->s_root is non-zero) up_read() as shown
below:

/**
 *      get_super - get the superblock of a device
 *      @bdev: device to get the superblock for
 *
 *      Scans the superblock list and finds the superblock of the file system
 *      mounted on the device given. %NULL is returned if no match is found.
 */
struct super_block * get_super(struct block_device *bdev)
{
       struct super_block *sb;
       if (!bdev)
               return NULL;
       spin_lock(&sb_lock);
rescan:
       list_for_each_entry(sb, &super_blocks, s_list) {
               if (sb->s_bdev == bdev) {
                       sb->s_count++;
                       spin_unlock(&sb_lock);
                       down_read(&sb->s_umount);
                       if (sb->s_root)
                               return sb;
                       up_read(&sb->s_umount);
                       /* restart only when sb is no longer on the list */
                       spin_lock(&sb_lock);
                       if (__put_super_and_need_restart(sb))
                               goto rescan;
               }
       }
       spin_unlock(&sb_lock);
       return NULL;
}
Neither did the get_super() caller remember and correct the semaphore
either.   Is this a problem?


\
 
 \ /
  Last update: 2008-03-02 08:13    [from the cache]
©2003-2008