From: Lin Feng Shen <shenlinf@cn.ibm.com>
dump_swap_info() invokes get_pathname()
to get the file name of swap device.
If swap_vfsmnt isn't defined but old_block_size
is defined in kernel struct
swap_info_struct(e.g. 2.6 kernel), 0
is passed as vfsmnt to get_pathname().
In this case, get_pathname() won't go
up to the parent vfsmnt, so the file
name of swap space is shown incompletely.
Here is an example. crash-4.0-25 was
installed and udev was mounted on /dev
in sles10. Swap /dev/sda2 was active
before kdump. sub-command "swap" in
crash command showed an incomplete swap
file name.
---------------
crash> swap
FILENAME
TYPE SIZE USED
PCT PRIORITY
/sda2
PARTITION 2104504k 0k 0%
-1
---------------
The solution is to retrieve vfsmnt from
swap_file just as file_to_dentry()
does to get dentry, and then pass it
to get_pathname().
Signed-off-by: Lin Feng Shen <shenlinf@cn.ibm.com>
---
diff -ruNp crash-4.0-2.18.orig/defs.h
crash-4.0-2.18/defs.h
--- crash-4.0-2.18.orig/defs.h
2006-06-02 02:51:15.000000000 -0400
+++ crash-4.0-2.18/defs.h
2006-06-02 03:06:17.000000000 -0400
@@ -3031,6 +3031,7 @@ void close_tmpfile2(void);
void open_files_dump(ulong, int,
struct reference *);
void get_pathname(ulong, char
*, int, int, ulong);
ulong file_to_dentry(ulong);
+ulong file_to_vfsmnt(ulong);
void nlm_files_dump(void);
int get_proc_version(void);
int file_checksum(char *, long
*);
diff -ruNp crash-4.0-2.18.orig/filesys.c
crash-4.0-2.18/filesys.c
--- crash-4.0-2.18.orig/filesys.c
2006-06-02 02:51:14.000000000 -0400
+++ crash-4.0-2.18/filesys.c
2006-06-02 03:11:34.000000000 -0400
@@ -2544,6 +2544,20 @@ file_to_dentry(ulong
file)
}
/*
+ * Get the vfsmnt associated
with a file.
+ */
+ulong
+file_to_vfsmnt(ulong file)
+{
+ char *file_buf;
+ ulong vfsmnt;
+
+ file_buf
= fill_file_cache(file);
+ vfsmnt
= ULONG(file_buf + OFFSET(file_f_vfsmnt));
+ return
vfsmnt;
+}
+
+/*
* get_pathname() fills in a pathname
string for an ending dentry
* See __d_path() in the kernel
for help fixing problems.
*/
diff -ruNp crash-4.0-2.18.orig/memory.c
crash-4.0-2.18/memory.c
--- crash-4.0-2.18.orig/memory.c
2006-06-02 02:51:15.000000000 -0400
+++ crash-4.0-2.18/memory.c
2006-06-02 03:06:31.000000000 -0400
@@ -10293,7 +10293,7 @@ dump_swap_info(ulong
swapflags, ulong *t
}
else if (VALID_MEMBER
(swap_info_struct_old_block_size)) {
get_pathname(file_to_dentry(swap_file),
-
buf,
BUFSIZE, 1, 0);
+
buf,
BUFSIZE, 1, file_to_vfsmnt(swap_file));
}
else {
get_pathname(swap_file, buf, BUFSIZE,
1, 0);
}