aboutsummaryrefslogtreecommitdiffstats
path: root/fs/isofs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-21 18:22:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:57:36 -0400
commitda53be12bbb4fabbe2e9f6f908de0cf478b5161d (patch)
treea0436fb462a7b16c82e58336e17c55b814f7be6b /fs/isofs
parent642b704cd7a29be0b8900971eb525086c1c995b7 (diff)
Don't pass inode to ->d_hash() and ->d_compare()
Instances either don't look at it at all (the majority of cases) or only want it to find the superblock (which can be had as dentry->d_sb). A few cases that want more are actually safe with dentry->d_inode - the only precaution needed is the check that it hadn't been replaced with NULL by rmdir() or by overwriting rename(), which case should be simply treated as cache miss. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/isofs')
-rw-r--r--fs/isofs/inode.c48
-rw-r--r--fs/isofs/namei.c3
2 files changed, 17 insertions, 34 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index d9b8aebdeb22..c348d6d88624 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -28,31 +28,23 @@
28 28
29#define BEQUIET 29#define BEQUIET
30 30
31static int isofs_hashi(const struct dentry *parent, const struct inode *inode, 31static int isofs_hashi(const struct dentry *parent, struct qstr *qstr);
32 struct qstr *qstr); 32static int isofs_hash(const struct dentry *parent, struct qstr *qstr);
33static int isofs_hash(const struct dentry *parent, const struct inode *inode,
34 struct qstr *qstr);
35static int isofs_dentry_cmpi(const struct dentry *parent, 33static int isofs_dentry_cmpi(const struct dentry *parent,
36 const struct inode *pinode, 34 const struct dentry *dentry,
37 const struct dentry *dentry, const struct inode *inode,
38 unsigned int len, const char *str, const struct qstr *name); 35 unsigned int len, const char *str, const struct qstr *name);
39static int isofs_dentry_cmp(const struct dentry *parent, 36static int isofs_dentry_cmp(const struct dentry *parent,
40 const struct inode *pinode, 37 const struct dentry *dentry,
41 const struct dentry *dentry, const struct inode *inode,
42 unsigned int len, const char *str, const struct qstr *name); 38 unsigned int len, const char *str, const struct qstr *name);
43 39
44#ifdef CONFIG_JOLIET 40#ifdef CONFIG_JOLIET
45static int isofs_hashi_ms(const struct dentry *parent, const struct inode *inode, 41static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr);
46 struct qstr *qstr); 42static int isofs_hash_ms(const struct dentry *parent, struct qstr *qstr);
47static int isofs_hash_ms(const struct dentry *parent, const struct inode *inode,
48 struct qstr *qstr);
49static int isofs_dentry_cmpi_ms(const struct dentry *parent, 43static int isofs_dentry_cmpi_ms(const struct dentry *parent,
50 const struct inode *pinode, 44 const struct dentry *dentry,
51 const struct dentry *dentry, const struct inode *inode,
52 unsigned int len, const char *str, const struct qstr *name); 45 unsigned int len, const char *str, const struct qstr *name);
53static int isofs_dentry_cmp_ms(const struct dentry *parent, 46static int isofs_dentry_cmp_ms(const struct dentry *parent,
54 const struct inode *pinode, 47 const struct dentry *dentry,
55 const struct dentry *dentry, const struct inode *inode,
56 unsigned int len, const char *str, const struct qstr *name); 48 unsigned int len, const char *str, const struct qstr *name);
57#endif 49#endif
58 50
@@ -265,30 +257,26 @@ static int isofs_dentry_cmp_common(
265} 257}
266 258
267static int 259static int
268isofs_hash(const struct dentry *dentry, const struct inode *inode, 260isofs_hash(const struct dentry *dentry, struct qstr *qstr)
269 struct qstr *qstr)
270{ 261{
271 return isofs_hash_common(dentry, qstr, 0); 262 return isofs_hash_common(dentry, qstr, 0);
272} 263}
273 264
274static int 265static int
275isofs_hashi(const struct dentry *dentry, const struct inode *inode, 266isofs_hashi(const struct dentry *dentry, struct qstr *qstr)
276 struct qstr *qstr)
277{ 267{
278 return isofs_hashi_common(dentry, qstr, 0); 268 return isofs_hashi_common(dentry, qstr, 0);
279} 269}
280 270
281static int 271static int
282isofs_dentry_cmp(const struct dentry *parent, const struct inode *pinode, 272isofs_dentry_cmp(const struct dentry *parent, const struct dentry *dentry,
283 const struct dentry *dentry, const struct inode *inode,
284 unsigned int len, const char *str, const struct qstr *name) 273 unsigned int len, const char *str, const struct qstr *name)
285{ 274{
286 return isofs_dentry_cmp_common(len, str, name, 0, 0); 275 return isofs_dentry_cmp_common(len, str, name, 0, 0);
287} 276}
288 277
289static int 278static int
290isofs_dentry_cmpi(const struct dentry *parent, const struct inode *pinode, 279isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry,
291 const struct dentry *dentry, const struct inode *inode,
292 unsigned int len, const char *str, const struct qstr *name) 280 unsigned int len, const char *str, const struct qstr *name)
293{ 281{
294 return isofs_dentry_cmp_common(len, str, name, 0, 1); 282 return isofs_dentry_cmp_common(len, str, name, 0, 1);
@@ -296,30 +284,26 @@ isofs_dentry_cmpi(const struct dentry *parent, const struct inode *pinode,
296 284
297#ifdef CONFIG_JOLIET 285#ifdef CONFIG_JOLIET
298static int 286static int
299isofs_hash_ms(const struct dentry *dentry, const struct inode *inode, 287isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr)
300 struct qstr *qstr)
301{ 288{
302 return isofs_hash_common(dentry, qstr, 1); 289 return isofs_hash_common(dentry, qstr, 1);
303} 290}
304 291
305static int 292static int
306isofs_hashi_ms(const struct dentry *dentry, const struct inode *inode, 293isofs_hashi_ms(const struct dentry *dentry, struct qstr *qstr)
307 struct qstr *qstr)
308{ 294{
309 return isofs_hashi_common(dentry, qstr, 1); 295 return isofs_hashi_common(dentry, qstr, 1);
310} 296}
311 297
312static int 298static int
313isofs_dentry_cmp_ms(const struct dentry *parent, const struct inode *pinode, 299isofs_dentry_cmp_ms(const struct dentry *parent, const struct dentry *dentry,
314 const struct dentry *dentry, const struct inode *inode,
315 unsigned int len, const char *str, const struct qstr *name) 300 unsigned int len, const char *str, const struct qstr *name)
316{ 301{
317 return isofs_dentry_cmp_common(len, str, name, 1, 0); 302 return isofs_dentry_cmp_common(len, str, name, 1, 0);
318} 303}
319 304
320static int 305static int
321isofs_dentry_cmpi_ms(const struct dentry *parent, const struct inode *pinode, 306isofs_dentry_cmpi_ms(const struct dentry *parent, const struct dentry *dentry,
322 const struct dentry *dentry, const struct inode *inode,
323 unsigned int len, const char *str, const struct qstr *name) 307 unsigned int len, const char *str, const struct qstr *name)
324{ 308{
325 return isofs_dentry_cmp_common(len, str, name, 1, 1); 309 return isofs_dentry_cmp_common(len, str, name, 1, 1);
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
index c167028844ed..95295640d9c8 100644
--- a/fs/isofs/namei.c
+++ b/fs/isofs/namei.c
@@ -37,8 +37,7 @@ isofs_cmp(struct dentry *dentry, const char *compare, int dlen)
37 37
38 qstr.name = compare; 38 qstr.name = compare;
39 qstr.len = dlen; 39 qstr.len = dlen;
40 return dentry->d_op->d_compare(NULL, NULL, NULL, NULL, 40 return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr);
41 dentry->d_name.len, dentry->d_name.name, &qstr);
42} 41}
43 42
44/* 43/*