void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx);
void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx);
-/* We need to hold the inode semaphore over the dcache lookup itself, or we
- * run the risk of entering the filesystem lookup path concurrently on SMP
- * systems, and instantiating two inodes for the same entry. We still
- * protect against concurrent addition/removal races with the DLM locking.
- */
-static inline struct dentry *
-ll_lookup_one_len(const char *fid_name, struct dentry *dparent,
- int fid_namelen)
-{
- struct dentry *dchild;
-
- inode_lock(dparent->d_inode);
- dchild = lookup_one_len(fid_name, dparent, fid_namelen);
- inode_unlock(dparent->d_inode);
-
- if (IS_ERR(dchild) || dchild->d_inode == NULL)
- return dchild;
-
- if (is_bad_inode(dchild->d_inode)) {
- CERROR("bad inode returned %lu/%u\n",
- dchild->d_inode->i_ino, dchild->d_inode->i_generation);
- dput(dchild);
- dchild = ERR_PTR(-ENOENT);
- }
-
- return dchild;
-}
-
#endif
}
/**
+ * osd_lookup_one_len_unlocked
+ *
+ * @name: pathname component to lookup
+ * @base: base directory to lookup from
+ * @len: maximum length @len should be interpreted to
+ *
+ * This should be called without the parent
+ * i_mutex held, and will take the i_mutex itself.
+ *
+ * Unlike osd_lookup_one_len dentry with NULL d_inode is valid
+ */
+struct dentry *osd_lookup_one_len_unlocked(const char *name,
+ struct dentry *base, int len)
+{
+ struct dentry *dchild;
+
+ inode_lock(base->d_inode);
+ dchild = lookup_one_len(name, base, len);
+ inode_unlock(base->d_inode);
+
+ if (IS_ERR(dchild) || dchild->d_inode == NULL)
+ return dchild;
+
+ if (is_bad_inode(dchild->d_inode)) {
+ CERROR("bad inode returned %lu/%u\n",
+ dchild->d_inode->i_ino, dchild->d_inode->i_generation);
+ dput(dchild);
+ dchild = ERR_PTR(-ENOENT);
+ }
+
+ return dchild;
+}
+
+/**
* osd_ios_lookup_one_len - lookup single pathname component
*
* @name: pathname component to lookup
{
struct dentry *dentry;
- dentry = ll_lookup_one_len(name, base, len);
+ dentry = osd_lookup_one_len_unlocked(name, base, len);
if (IS_ERR(dentry)) {
int rc = PTR_ERR(dentry);
// ASSERT_KERNEL_CTXT("kernel doing mkdir outside kernel context\n");
CDEBUG(D_INODE, "creating directory %.*s\n", (int)strlen(name), name);
- dchild = ll_lookup_one_len(name, dir, strlen(name));
+ dchild = osd_lookup_one_len_unlocked(name, dir, strlen(name));
if (IS_ERR(dchild))
RETURN(dchild);
ENTRY;
- dlast = ll_lookup_one_len(LAST_RCVD, osd_sb(osd)->s_root,
- strlen(LAST_RCVD));
+ dlast = osd_lookup_one_len_unlocked(LAST_RCVD, osd_sb(osd)->s_root,
+ strlen(LAST_RCVD));
if (IS_ERR(dlast))
return PTR_ERR(dlast);
else if (dlast->d_inode == NULL)
RETURN(-ENOENT);
}
- dentry = ll_lookup_one_len(name, root, strlen(name));
+ dentry = osd_lookup_one_len_unlocked(name, root, strlen(name));
if (!IS_ERR(dentry)) {
inode = dentry->d_inode;
if (inode) {
struct inode *inode;
int rc;
- dentry = ll_lookup_one_len(name, osd_sb(osd)->s_root, strlen(name));
+ dentry = osd_lookup_one_len_unlocked(name, osd_sb(osd)->s_root,
+ strlen(name));
if (IS_ERR(dentry))
return (void *) dentry;
if (rc)
return ERR_PTR(rc);
- dentry = ll_lookup_one_len(name, osd_sb(osd)->s_root, strlen(name));
+ dentry = osd_lookup_one_len_unlocked(name, osd_sb(osd)->s_root,
+ strlen(name));
if (IS_ERR(dentry))
return (void *) dentry;
struct dentry *child;
int rc;
- child = ll_lookup_one_len(name, parent, namelen);
+ child = osd_lookup_one_len_unlocked(name, parent, namelen);
if (IS_ERR(child)) {
rc = PTR_ERR(child);
} else {