OBD_SET_CTXT_MAGIC(newctxt);
newctxt->pwdmnt = dev->od_mnt;
newctxt->pwd = dev->od_mnt->mnt_root;
- newctxt->fs = get_ds();
+ newctxt->fs = KERNEL_DS;
newctxt->umask = current_umask();
newctxt->dt = NULL;
push_ctxt(save, newctxt);
}
+/**
+ * osd_ios_lookup_one_len - lookup single pathname component
+ *
+ * @name: pathname component to lookup
+ * @base: base directory to lookup from
+ * @len: maximum length @len should be interpreted to
+ *
+ * Treat found dentry with NULL d_inode as an -ENOENT error so LFSCK
+ * can repair the file.
+ */
+struct dentry *osd_ios_lookup_one_len(const char *name, struct dentry *base,
+ int len)
+{
+ struct dentry *dentry;
+
+ dentry = ll_lookup_one_len(name, base, len);
+ if (IS_ERR(dentry)) {
+ int rc = PTR_ERR(dentry);
+
+ if (rc != -ENOENT)
+ CERROR("Fail to find %.*s in %.*s (%lu/%u): rc = %d\n",
+ len, name, base->d_name.len,
+ base->d_name.name, base->d_inode->i_ino,
+ base->d_inode->i_generation, rc);
+
+ return dentry;
+ }
+
+ if (dentry->d_inode == NULL) {
+ dput(dentry);
+ return ERR_PTR(-ENOENT);
+ }
+
+ return dentry;
+}
+
/* utility to make a directory */
static struct dentry *
simple_mkdir(const struct lu_env *env, struct osd_device *osd,
if (unlikely(rc == -ENOENT))
rc = 0;
}
- RETURN(rc);
+ if (rc)
+ RETURN(rc);
}
bh = osd_ldiskfs_find_entry(src_parent, &src_child->d_name, &de,
#ifndef HAVE_BIO_INTEGRITY_ENABLED
bool bio_integrity_enabled(struct bio *bio)
{
-# ifdef HAVE_BI_BDEV
- struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev);
-# else
- struct blk_integrity *bi = blk_get_integrity(bio->bi_disk);
-# endif
+ struct blk_integrity *bi = blk_get_integrity(bio_get_disk(bio));
if (bio_op(bio) != REQ_OP_READ && bio_op(bio) != REQ_OP_WRITE)
return false;