Skip to content

Commit

Permalink
[PATCH] reiserfs: fix handling of device names with /'s in them
Browse files Browse the repository at this point in the history
On systems with block devices containing a slash (virtual dasd, cciss,
etc), reiserfs will fail to initialize /proc/fs/reiserfs/<dev> due to it
being interpreted as a subdirectory.  The generic block device code changes
the / to !  for use in the sysfs tree.  This patch uses that convention.

Tested by making dm devices use dm/<number> rather than dm-<number>

[akpm@osdl.org: name variables consistently]
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jeff Mahoney authored and Linus Torvalds committed Jul 15, 2006
1 parent bca3bff commit 6fbe82a
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions fs/reiserfs/procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,17 @@ static void add_file(struct super_block *sb, char *name,

int reiserfs_proc_info_init(struct super_block *sb)
{
char b[BDEVNAME_SIZE];
char *s;

/* Some block devices use /'s */
strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE);
s = strchr(b, '/');
if (s)
*s = '!';

spin_lock_init(&__PINFO(sb).lock);
REISERFS_SB(sb)->procdir =
proc_mkdir(reiserfs_bdevname(sb), proc_info_root);
REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root);
if (REISERFS_SB(sb)->procdir) {
REISERFS_SB(sb)->procdir->owner = THIS_MODULE;
REISERFS_SB(sb)->procdir->data = sb;
Expand All @@ -508,13 +516,22 @@ int reiserfs_proc_info_init(struct super_block *sb)
return 0;
}
reiserfs_warning(sb, "reiserfs: cannot create /proc/%s/%s",
proc_info_root_name, reiserfs_bdevname(sb));
proc_info_root_name, b);
return 1;
}

int reiserfs_proc_info_done(struct super_block *sb)
{
struct proc_dir_entry *de = REISERFS_SB(sb)->procdir;
char b[BDEVNAME_SIZE];
char *s;

/* Some block devices use /'s */
strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE);
s = strchr(b, '/');
if (s)
*s = '!';

if (de) {
remove_proc_entry("journal", de);
remove_proc_entry("oidmap", de);
Expand All @@ -528,7 +545,7 @@ int reiserfs_proc_info_done(struct super_block *sb)
__PINFO(sb).exiting = 1;
spin_unlock(&__PINFO(sb).lock);
if (proc_info_root) {
remove_proc_entry(reiserfs_bdevname(sb), proc_info_root);
remove_proc_entry(b, proc_info_root);
REISERFS_SB(sb)->procdir = NULL;
}
return 0;
Expand Down

0 comments on commit 6fbe82a

Please sign in to comment.