aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/lustre/lustre/llite/dcache.c33
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_internal.h17
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_nfs.c22
-rw-r--r--drivers/staging/lustre/lustre/llite/namei.c13
-rw-r--r--drivers/staging/lustre/lustre/llite/statahead.c4
5 files changed, 18 insertions, 71 deletions
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c
index 0e45d8fc4d7c..65bf0c401b44 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -57,9 +57,6 @@ static void ll_release(struct dentry *de)
57 57
58 LASSERT(de); 58 LASSERT(de);
59 lld = ll_d2d(de); 59 lld = ll_d2d(de);
60 if (!lld) /* NFS copies the de->d_op methods (bug 4655) */
61 return;
62
63 if (lld->lld_it) { 60 if (lld->lld_it) {
64 ll_intent_release(lld->lld_it); 61 ll_intent_release(lld->lld_it);
65 kfree(lld->lld_it); 62 kfree(lld->lld_it);
@@ -126,30 +123,13 @@ static int ll_ddelete(const struct dentry *de)
126 return 0; 123 return 0;
127} 124}
128 125
129int ll_d_init(struct dentry *de) 126static int ll_d_init(struct dentry *de)
130{ 127{
131 CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n", 128 struct ll_dentry_data *lld = kzalloc(sizeof(*lld), GFP_KERNEL);
132 de, de, de->d_parent, d_inode(de), d_count(de)); 129 if (unlikely(!lld))
133 130 return -ENOMEM;
134 if (!de->d_fsdata) { 131 lld->lld_invalid = 1;
135 struct ll_dentry_data *lld; 132 de->d_fsdata = lld;
136
137 lld = kzalloc(sizeof(*lld), GFP_NOFS);
138 if (likely(lld)) {
139 spin_lock(&de->d_lock);
140 if (likely(!de->d_fsdata)) {
141 de->d_fsdata = lld;
142 __d_lustre_invalidate(de);
143 } else {
144 kfree(lld);
145 }
146 spin_unlock(&de->d_lock);
147 } else {
148 return -ENOMEM;
149 }
150 }
151 LASSERT(de->d_op == &ll_d_ops);
152
153 return 0; 133 return 0;
154} 134}
155 135
@@ -300,6 +280,7 @@ static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags)
300} 280}
301 281
302const struct dentry_operations ll_d_ops = { 282const struct dentry_operations ll_d_ops = {
283 .d_init = ll_d_init,
303 .d_revalidate = ll_revalidate_nd, 284 .d_revalidate = ll_revalidate_nd,
304 .d_release = ll_release, 285 .d_release = ll_release,
305 .d_delete = ll_ddelete, 286 .d_delete = ll_ddelete,
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 4bc551279aa4..507c6039b7a9 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -801,7 +801,6 @@ int ll_hsm_release(struct inode *inode);
801 801
802/* llite/dcache.c */ 802/* llite/dcache.c */
803 803
804int ll_d_init(struct dentry *de);
805extern const struct dentry_operations ll_d_ops; 804extern const struct dentry_operations ll_d_ops;
806void ll_intent_drop_lock(struct lookup_intent *); 805void ll_intent_drop_lock(struct lookup_intent *);
807void ll_intent_release(struct lookup_intent *); 806void ll_intent_release(struct lookup_intent *);
@@ -1189,7 +1188,7 @@ dentry_may_statahead(struct inode *dir, struct dentry *dentry)
1189 * 'lld_sa_generation == lli->lli_sa_generation'. 1188 * 'lld_sa_generation == lli->lli_sa_generation'.
1190 */ 1189 */
1191 ldd = ll_d2d(dentry); 1190 ldd = ll_d2d(dentry);
1192 if (ldd && ldd->lld_sa_generation == lli->lli_sa_generation) 1191 if (ldd->lld_sa_generation == lli->lli_sa_generation)
1193 return false; 1192 return false;
1194 1193
1195 return true; 1194 return true;
@@ -1317,17 +1316,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode,
1317 1316
1318static inline int d_lustre_invalid(const struct dentry *dentry) 1317static inline int d_lustre_invalid(const struct dentry *dentry)
1319{ 1318{
1320 struct ll_dentry_data *lld = ll_d2d(dentry); 1319 return ll_d2d(dentry)->lld_invalid;
1321
1322 return !lld || lld->lld_invalid;
1323}
1324
1325static inline void __d_lustre_invalidate(struct dentry *dentry)
1326{
1327 struct ll_dentry_data *lld = ll_d2d(dentry);
1328
1329 if (lld)
1330 lld->lld_invalid = 1;
1331} 1320}
1332 1321
1333/* 1322/*
@@ -1343,7 +1332,7 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested)
1343 1332
1344 spin_lock_nested(&dentry->d_lock, 1333 spin_lock_nested(&dentry->d_lock,
1345 nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL); 1334 nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL);
1346 __d_lustre_invalidate(dentry); 1335 ll_d2d(dentry)->lld_invalid = 1;
1347 /* 1336 /*
1348 * We should be careful about dentries created by d_obtain_alias(). 1337 * We should be careful about dentries created by d_obtain_alias().
1349 * These dentries are not put in the dentry tree, instead they are 1338 * These dentries are not put in the dentry tree, instead they are
diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c
index 709230571b4b..2ad9dc2665f3 100644
--- a/drivers/staging/lustre/lustre/llite/llite_nfs.c
+++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c
@@ -169,22 +169,12 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren
169 /* N.B. d_obtain_alias() drops inode ref on error */ 169 /* N.B. d_obtain_alias() drops inode ref on error */
170 result = d_obtain_alias(inode); 170 result = d_obtain_alias(inode);
171 if (!IS_ERR(result)) { 171 if (!IS_ERR(result)) {
172 int rc; 172 /*
173 173 * Need to signal to the ll_intent_file_open that
174 rc = ll_d_init(result); 174 * we came from NFS and so opencache needs to be
175 if (rc < 0) { 175 * enabled for this one
176 dput(result); 176 */
177 result = ERR_PTR(rc); 177 ll_d2d(result)->lld_nfs_dentry = 1;
178 } else {
179 struct ll_dentry_data *ldd = ll_d2d(result);
180
181 /*
182 * Need to signal to the ll_intent_file_open that
183 * we came from NFS and so opencache needs to be
184 * enabled for this one
185 */
186 ldd->lld_nfs_dentry = 1;
187 }
188 } 178 }
189 179
190 return result; 180 return result;
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 180f35e3afd9..31a771319cbc 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -395,17 +395,9 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
395 */ 395 */
396struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) 396struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
397{ 397{
398 struct dentry *new;
399 int rc;
400
401 if (inode) { 398 if (inode) {
402 new = ll_find_alias(inode, de); 399 struct dentry *new = ll_find_alias(inode, de);
403 if (new) { 400 if (new) {
404 rc = ll_d_init(new);
405 if (rc < 0) {
406 dput(new);
407 return ERR_PTR(rc);
408 }
409 d_move(new, de); 401 d_move(new, de);
410 iput(inode); 402 iput(inode);
411 CDEBUG(D_DENTRY, 403 CDEBUG(D_DENTRY,
@@ -414,9 +406,6 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de)
414 return new; 406 return new;
415 } 407 }
416 } 408 }
417 rc = ll_d_init(de);
418 if (rc < 0)
419 return ERR_PTR(rc);
420 d_add(de, inode); 409 d_add(de, inode);
421 CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n", 410 CDEBUG(D_DENTRY, "Add dentry %p inode %p refc %d flags %#x\n",
422 de, d_inode(de), d_count(de), de->d_flags); 411 de, d_inode(de), d_count(de), de->d_flags);
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 0677513476ec..166323fddc44 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -1513,9 +1513,7 @@ out_unplug:
1513 */ 1513 */
1514 ldd = ll_d2d(*dentryp); 1514 ldd = ll_d2d(*dentryp);
1515 lli = ll_i2info(dir); 1515 lli = ll_i2info(dir);
1516 /* ldd can be NULL if llite lookup failed. */ 1516 ldd->lld_sa_generation = lli->lli_sa_generation;
1517 if (ldd)
1518 ldd->lld_sa_generation = lli->lli_sa_generation;
1519 sa_put(sai, entry); 1517 sa_put(sai, entry);
1520 return rc; 1518 return rc;
1521} 1519}