Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f21f6220
Commit
f21f6220
authored
Jun 24, 2009
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
... and the same for vfsmount id/mount group id
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
c63e09ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
fs/namespace.c
fs/namespace.c
+22
-4
fs/super.c
fs/super.c
+4
-2
No files found.
fs/namespace.c
View file @
f21f6220
...
...
@@ -42,6 +42,8 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock);
static
int
event
;
static
DEFINE_IDA
(
mnt_id_ida
);
static
DEFINE_IDA
(
mnt_group_ida
);
static
int
mnt_id_start
=
0
;
static
int
mnt_group_start
=
1
;
static
struct
list_head
*
mount_hashtable
__read_mostly
;
static
struct
kmem_cache
*
mnt_cache
__read_mostly
;
...
...
@@ -69,7 +71,9 @@ static int mnt_alloc_id(struct vfsmount *mnt)
retry:
ida_pre_get
(
&
mnt_id_ida
,
GFP_KERNEL
);
spin_lock
(
&
vfsmount_lock
);
res
=
ida_get_new
(
&
mnt_id_ida
,
&
mnt
->
mnt_id
);
res
=
ida_get_new_above
(
&
mnt_id_ida
,
mnt_id_start
,
&
mnt
->
mnt_id
);
if
(
!
res
)
mnt_id_start
=
mnt
->
mnt_id
+
1
;
spin_unlock
(
&
vfsmount_lock
);
if
(
res
==
-
EAGAIN
)
goto
retry
;
...
...
@@ -79,8 +83,11 @@ static int mnt_alloc_id(struct vfsmount *mnt)
static
void
mnt_free_id
(
struct
vfsmount
*
mnt
)
{
int
id
=
mnt
->
mnt_id
;
spin_lock
(
&
vfsmount_lock
);
ida_remove
(
&
mnt_id_ida
,
mnt
->
mnt_id
);
ida_remove
(
&
mnt_id_ida
,
id
);
if
(
mnt_id_start
>
id
)
mnt_id_start
=
id
;
spin_unlock
(
&
vfsmount_lock
);
}
...
...
@@ -91,10 +98,18 @@ static void mnt_free_id(struct vfsmount *mnt)
*/
static
int
mnt_alloc_group_id
(
struct
vfsmount
*
mnt
)
{
int
res
;
if
(
!
ida_pre_get
(
&
mnt_group_ida
,
GFP_KERNEL
))
return
-
ENOMEM
;
return
ida_get_new_above
(
&
mnt_group_ida
,
1
,
&
mnt
->
mnt_group_id
);
res
=
ida_get_new_above
(
&
mnt_group_ida
,
mnt_group_start
,
&
mnt
->
mnt_group_id
);
if
(
!
res
)
mnt_group_start
=
mnt
->
mnt_group_id
+
1
;
return
res
;
}
/*
...
...
@@ -102,7 +117,10 @@ static int mnt_alloc_group_id(struct vfsmount *mnt)
*/
void
mnt_release_group_id
(
struct
vfsmount
*
mnt
)
{
ida_remove
(
&
mnt_group_ida
,
mnt
->
mnt_group_id
);
int
id
=
mnt
->
mnt_group_id
;
ida_remove
(
&
mnt_group_ida
,
id
);
if
(
mnt_group_start
>
id
)
mnt_group_start
=
id
;
mnt
->
mnt_group_id
=
0
;
}
...
...
fs/super.c
View file @
f21f6220
...
...
@@ -620,6 +620,7 @@ int set_anon_super(struct super_block *s, void *data)
return
-
ENOMEM
;
spin_lock
(
&
unnamed_dev_lock
);
error
=
ida_get_new_above
(
&
unnamed_dev_ida
,
unnamed_dev_start
,
&
dev
);
if
(
!
error
)
unnamed_dev_start
=
dev
+
1
;
spin_unlock
(
&
unnamed_dev_lock
);
if
(
error
==
-
EAGAIN
)
...
...
@@ -631,6 +632,7 @@ int set_anon_super(struct super_block *s, void *data)
if
((
dev
&
MAX_ID_MASK
)
==
(
1
<<
MINORBITS
))
{
spin_lock
(
&
unnamed_dev_lock
);
ida_remove
(
&
unnamed_dev_ida
,
dev
);
if
(
unnamed_dev_start
>
dev
)
unnamed_dev_start
=
dev
;
spin_unlock
(
&
unnamed_dev_lock
);
return
-
EMFILE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment