diff options
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/super.c b/fs/super.c index 9b780c42d845..5c4c94d5495e 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -49,11 +49,12 @@ DEFINE_SPINLOCK(sb_lock); | |||
49 | 49 | ||
50 | /** | 50 | /** |
51 | * alloc_super - create new superblock | 51 | * alloc_super - create new superblock |
52 | * @type: filesystem type superblock should belong to | ||
52 | * | 53 | * |
53 | * Allocates and initializes a new &struct super_block. alloc_super() | 54 | * Allocates and initializes a new &struct super_block. alloc_super() |
54 | * returns a pointer new superblock or %NULL if allocation had failed. | 55 | * returns a pointer new superblock or %NULL if allocation had failed. |
55 | */ | 56 | */ |
56 | static struct super_block *alloc_super(void) | 57 | static struct super_block *alloc_super(struct file_system_type *type) |
57 | { | 58 | { |
58 | struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); | 59 | struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); |
59 | static struct super_operations default_op; | 60 | static struct super_operations default_op; |
@@ -72,6 +73,13 @@ static struct super_block *alloc_super(void) | |||
72 | INIT_LIST_HEAD(&s->s_inodes); | 73 | INIT_LIST_HEAD(&s->s_inodes); |
73 | init_rwsem(&s->s_umount); | 74 | init_rwsem(&s->s_umount); |
74 | mutex_init(&s->s_lock); | 75 | mutex_init(&s->s_lock); |
76 | lockdep_set_class(&s->s_umount, &type->s_umount_key); | ||
77 | /* | ||
78 | * The locking rules for s_lock are up to the | ||
79 | * filesystem. For example ext3fs has different | ||
80 | * lock ordering than usbfs: | ||
81 | */ | ||
82 | lockdep_set_class(&s->s_lock, &type->s_lock_key); | ||
75 | down_write(&s->s_umount); | 83 | down_write(&s->s_umount); |
76 | s->s_count = S_BIAS; | 84 | s->s_count = S_BIAS; |
77 | atomic_set(&s->s_active, 1); | 85 | atomic_set(&s->s_active, 1); |
@@ -295,7 +303,7 @@ retry: | |||
295 | } | 303 | } |
296 | if (!s) { | 304 | if (!s) { |
297 | spin_unlock(&sb_lock); | 305 | spin_unlock(&sb_lock); |
298 | s = alloc_super(); | 306 | s = alloc_super(type); |
299 | if (!s) | 307 | if (!s) |
300 | return ERR_PTR(-ENOMEM); | 308 | return ERR_PTR(-ENOMEM); |
301 | goto retry; | 309 | goto retry; |