aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/svcsubs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd/svcsubs.c')
-rw-r--r--fs/lockd/svcsubs.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index de7536358c7c..62f4a385177f 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -30,6 +30,36 @@
30static struct nlm_file * nlm_files[FILE_NRHASH]; 30static struct nlm_file * nlm_files[FILE_NRHASH];
31static DECLARE_MUTEX(nlm_file_sema); 31static DECLARE_MUTEX(nlm_file_sema);
32 32
33#ifdef NFSD_DEBUG
34static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
35{
36 u32 *fhp = (u32*)f->data;
37
38 /* print the first 32 bytes of the fh */
39 dprintk("lockd: %s (%08x %08x %08x %08x %08x %08x %08x %08x)\n",
40 msg, fhp[0], fhp[1], fhp[2], fhp[3],
41 fhp[4], fhp[5], fhp[6], fhp[7]);
42}
43
44static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
45{
46 struct inode *inode = file->f_file->f_dentry->d_inode;
47
48 dprintk("lockd: %s %s/%ld\n",
49 msg, inode->i_sb->s_id, inode->i_ino);
50}
51#else
52static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
53{
54 return;
55}
56
57static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
58{
59 return;
60}
61#endif
62
33static inline unsigned int file_hash(struct nfs_fh *f) 63static inline unsigned int file_hash(struct nfs_fh *f)
34{ 64{
35 unsigned int tmp=0; 65 unsigned int tmp=0;
@@ -55,11 +85,8 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
55 struct nlm_file *file; 85 struct nlm_file *file;
56 unsigned int hash; 86 unsigned int hash;
57 u32 nfserr; 87 u32 nfserr;
58 u32 *fhp = (u32*)f->data;
59
60 dprintk("lockd: nlm_file_lookup(%08x %08x %08x %08x %08x %08x)\n",
61 fhp[0], fhp[1], fhp[2], fhp[3], fhp[4], fhp[5]);
62 88
89 nlm_debug_print_fh("nlm_file_lookup", f);
63 90
64 hash = file_hash(f); 91 hash = file_hash(f);
65 92
@@ -70,8 +97,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
70 if (!nfs_compare_fh(&file->f_handle, f)) 97 if (!nfs_compare_fh(&file->f_handle, f))
71 goto found; 98 goto found;
72 99
73 dprintk("lockd: creating file for (%08x %08x %08x %08x %08x %08x)\n", 100 nlm_debug_print_fh("creating file for", f);
74 fhp[0], fhp[1], fhp[2], fhp[3], fhp[4], fhp[5]);
75 101
76 nfserr = nlm_lck_denied_nolocks; 102 nfserr = nlm_lck_denied_nolocks;
77 file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL); 103 file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL);
@@ -124,11 +150,10 @@ out_free:
124static inline void 150static inline void
125nlm_delete_file(struct nlm_file *file) 151nlm_delete_file(struct nlm_file *file)
126{ 152{
127 struct inode *inode = file->f_file->f_dentry->d_inode;
128 struct nlm_file **fp, *f; 153 struct nlm_file **fp, *f;
129 154
130 dprintk("lockd: closing file %s/%ld\n", 155 nlm_debug_print_file("closing file", file);
131 inode->i_sb->s_id, inode->i_ino); 156
132 fp = nlm_files + file->f_hash; 157 fp = nlm_files + file->f_hash;
133 while ((f = *fp) != NULL) { 158 while ((f = *fp) != NULL) {
134 if (f == file) { 159 if (f == file) {