* Unmatched semaphore usage in fs/super.c
@ 2008-03-02 7:10 Peter Teoh
2008-03-02 7:58 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: Peter Teoh @ 2008-03-02 7:10 UTC (permalink / raw)
To: LKML
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Unmatched semaphore usage in fs/super.c
2008-03-02 7:10 Unmatched semaphore usage in fs/super.c Peter Teoh
@ 2008-03-02 7:58 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2008-03-02 7:58 UTC (permalink / raw)
To: Peter Teoh; +Cc: LKML
On Sun, Mar 02, 2008 at 03:10:35PM +0800, Peter Teoh wrote:
> 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:
Correct. get_super() and user_get_super() return locked superblock.
> Neither did the get_super() caller remember and correct the semaphore
> either. Is this a problem?
It would be, if it would be true. Take a look at drop_super().
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-02 7:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-02 7:10 Unmatched semaphore usage in fs/super.c Peter Teoh
2008-03-02 7:58 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox