diff options
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/lustre/lustre/libcfs/tracefile.c | 4 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/dcache.c | 21 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/dir.c | 9 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/file.c | 158 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/llite_internal.h | 10 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/llite_lib.c | 8 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/llite_mmap.c | 12 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/llite_nfs.c | 8 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/lloop.c | 7 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/namei.c | 388 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/statahead.c | 33 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/vvp_io.c | 4 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/xattr.c | 9 |
13 files changed, 278 insertions, 393 deletions
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index 7e3f6a45da00..7561030c96e6 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -1025,8 +1025,8 @@ static int tracefiled(void *arg) if (f_pos >= (off_t)cfs_tracefile_size) f_pos = 0; - else if (f_pos > i_size_read(filp->f_dentry->d_inode)) - f_pos = i_size_read(filp->f_dentry->d_inode); + else if (f_pos > i_size_read(file_inode(filp))) + f_pos = i_size_read(file_inode(filp)); buf = kmap(tage->page); rc = vfs_write(filp, (__force const char __user *)buf, diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 439e4875b05c..f692261e9b5c 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -151,10 +151,10 @@ static int ll_ddelete(const struct dentry *de) { LASSERT(de); - CDEBUG(D_DENTRY, "%s dentry %.*s (%p, parent %p, inode %p) %s%s\n", + CDEBUG(D_DENTRY, "%s dentry %pd (%p, parent %p, inode %p) %s%s\n", d_lustre_invalid((struct dentry *)de) ? "deleting" : "keeping", - de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode, - d_unhashed((struct dentry *)de) ? "" : "hashed,", + de, de, de->d_parent, de->d_inode, + d_unhashed(de) ? "" : "hashed,", list_empty(&de->d_subdirs) ? "" : "subdirs"); /* kernel >= 2.6.38 last refcount is decreased after this function. */ @@ -180,8 +180,8 @@ int ll_d_init(struct dentry *de) { LASSERT(de != NULL); - CDEBUG(D_DENTRY, "ldd on dentry %.*s (%p) parent %p inode %p refc %d\n", - de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode, + CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n", + de, de, de->d_parent, de->d_inode, d_count(de)); if (de->d_fsdata == NULL) { @@ -258,10 +258,9 @@ void ll_invalidate_aliases(struct inode *inode) inode->i_ino, inode->i_generation, inode); ll_lock_dcache(inode); - ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) { - CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p " - "inode %p flags %d\n", dentry->d_name.len, - dentry->d_name.name, dentry, dentry->d_parent, + ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) { + CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p " + "inode %p flags %d\n", dentry, dentry, dentry->d_parent, dentry->d_inode, dentry->d_flags); if (unlikely(dentry == dentry->d_sb->s_root)) { @@ -352,8 +351,8 @@ static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) { int rc; - CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n", - dentry->d_name.name, flags); + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, flags=%u\n", + dentry, flags); rc = ll_revalidate_dentry(dentry, flags); return rc; diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index b0bb7095dde5..a79fd65ec4c6 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -593,7 +593,7 @@ int ll_dir_read(struct inode *inode, struct dir_context *ctx) static int ll_readdir(struct file *filp, struct dir_context *ctx) { - struct inode *inode = filp->f_dentry->d_inode; + struct inode *inode = file_inode(filp); struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); struct ll_sb_info *sbi = ll_i2sbi(inode); int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; @@ -1242,7 +1242,7 @@ ll_getname(const char __user *filename) static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_sb_info *sbi = ll_i2sbi(inode); struct obd_ioctl_data *data; int rc = 0; @@ -1389,7 +1389,7 @@ lmv_out_free: return -EFAULT; } - if (inode->i_sb->s_root == file->f_dentry) + if (is_root_inode(inode)) set_default = 1; /* in v1 and v3 cases lumv1 points to data */ @@ -1780,8 +1780,7 @@ out_quotactl: return ll_flush_ctx(inode); #ifdef CONFIG_FS_POSIX_ACL case LL_IOC_RMTACL: { - if (sbi->ll_flags & LL_SBI_RMT_CLIENT && - inode == inode->i_sb->s_root->d_inode) { + if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); LASSERT(fd != NULL); diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index c99b74117152..a2ae9a68a9a0 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -266,6 +266,10 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct ll_inode_info *lli = ll_i2info(inode); + int lockmode; + __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; + struct lustre_handle lockh; + ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}}; int rc = 0; /* clear group lock, if present */ @@ -292,39 +296,26 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode, /* Let's see if we have good enough OPEN lock on the file and if we can skip talking to MDS */ - if (file->f_dentry->d_inode) { /* Can this ever be false? */ - int lockmode; - __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; - struct lustre_handle lockh; - struct inode *inode = file->f_dentry->d_inode; - ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}}; - - mutex_lock(&lli->lli_och_mutex); - if (fd->fd_omode & FMODE_WRITE) { - lockmode = LCK_CW; - LASSERT(lli->lli_open_fd_write_count); - lli->lli_open_fd_write_count--; - } else if (fd->fd_omode & FMODE_EXEC) { - lockmode = LCK_PR; - LASSERT(lli->lli_open_fd_exec_count); - lli->lli_open_fd_exec_count--; - } else { - lockmode = LCK_CR; - LASSERT(lli->lli_open_fd_read_count); - lli->lli_open_fd_read_count--; - } - mutex_unlock(&lli->lli_och_mutex); - if (!md_lock_match(md_exp, flags, ll_inode2fid(inode), - LDLM_IBITS, &policy, lockmode, - &lockh)) { - rc = ll_md_real_close(file->f_dentry->d_inode, - fd->fd_omode); - } + mutex_lock(&lli->lli_och_mutex); + if (fd->fd_omode & FMODE_WRITE) { + lockmode = LCK_CW; + LASSERT(lli->lli_open_fd_write_count); + lli->lli_open_fd_write_count--; + } else if (fd->fd_omode & FMODE_EXEC) { + lockmode = LCK_PR; + LASSERT(lli->lli_open_fd_exec_count); + lli->lli_open_fd_exec_count--; } else { - CERROR("Releasing a file %p with negative dentry %p. Name %s", - file, file->f_dentry, file->f_dentry->d_name.name); + lockmode = LCK_CR; + LASSERT(lli->lli_open_fd_read_count); + lli->lli_open_fd_read_count--; } + mutex_unlock(&lli->lli_och_mutex); + + if (!md_lock_match(md_exp, flags, ll_inode2fid(inode), + LDLM_IBITS, &policy, lockmode, &lockh)) + rc = ll_md_real_close(inode, fd->fd_omode); out: LUSTRE_FPRIVATE(file) = NULL; @@ -350,8 +341,7 @@ int ll_file_release(struct inode *inode, struct file *file) inode->i_generation, inode); #ifdef CONFIG_FS_POSIX_ACL - if (sbi->ll_flags & LL_SBI_RMT_CLIENT && - inode == inode->i_sb->s_root->d_inode) { + if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); LASSERT(fd != NULL); @@ -363,7 +353,7 @@ int ll_file_release(struct inode *inode, struct file *file) } #endif - if (inode->i_sb->s_root != file->f_dentry) + if (!is_root_inode(inode)) ll_stats_ops_tally(sbi, LPROC_LL_RELEASE, 1); fd = LUSTRE_FPRIVATE(file); LASSERT(fd != NULL); @@ -375,7 +365,7 @@ int ll_file_release(struct inode *inode, struct file *file) lli->lli_opendir_pid != 0) ll_stop_statahead(inode, lli->lli_opendir_key); - if (inode->i_sb->s_root == file->f_dentry) { + if (is_root_inode(inode)) { LUSTRE_FPRIVATE(file) = NULL; ll_file_data_put(fd); return 0; @@ -394,21 +384,19 @@ int ll_file_release(struct inode *inode, struct file *file) return rc; } -static int ll_intent_file_open(struct file *file, void *lmm, +static int ll_intent_file_open(struct dentry *dentry, void *lmm, int lmmsize, struct lookup_intent *itp) { - struct ll_sb_info *sbi = ll_i2sbi(file->f_dentry->d_inode); - struct dentry *parent = file->f_dentry->d_parent; - const char *name = file->f_dentry->d_name.name; - const int len = file->f_dentry->d_name.len; + struct inode *inode = dentry->d_inode; + struct ll_sb_info *sbi = ll_i2sbi(inode); + struct dentry *parent = dentry->d_parent; + const char *name = dentry->d_name.name; + const int len = dentry->d_name.len; struct md_op_data *op_data; struct ptlrpc_request *req; __u32 opc = LUSTRE_OPC_ANY; int rc; - if (!parent) - return -ENOENT; - /* Usually we come here only for NFSD, and we want open lock. But we can also get here with pre 2.6.15 patchless kernels, and in that case that lock is also ok */ @@ -425,7 +413,7 @@ static int ll_intent_file_open(struct file *file, void *lmm, } op_data = ll_prep_md_op_data(NULL, parent->d_inode, - file->f_dentry->d_inode, name, len, + inode, name, len, O_RDWR, opc, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); @@ -441,7 +429,7 @@ static int ll_intent_file_open(struct file *file, void *lmm, if (!it_disposition(itp, DISP_OPEN_OPEN) || it_open_error(DISP_OPEN_OPEN, itp)) goto out; - ll_release_openhandle(file->f_dentry, itp); + ll_release_openhandle(inode, itp); goto out; } @@ -456,10 +444,9 @@ static int ll_intent_file_open(struct file *file, void *lmm, goto out; } - rc = ll_prep_inode(&file->f_dentry->d_inode, req, NULL, itp); + rc = ll_prep_inode(&inode, req, NULL, itp); if (!rc && itp->d.lustre.it_lock_mode) - ll_set_lock_data(sbi->ll_md_exp, file->f_dentry->d_inode, - itp, NULL); + ll_set_lock_data(sbi->ll_md_exp, inode, itp, NULL); out: ptlrpc_req_finished(req); @@ -501,7 +488,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, static int ll_local_open(struct file *file, struct lookup_intent *it, struct ll_file_data *fd, struct obd_client_handle *och) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_inode_info *lli = ll_i2info(inode); LASSERT(!LUSTRE_FPRIVATE(file)); @@ -574,7 +561,7 @@ int ll_file_open(struct inode *inode, struct file *file) spin_unlock(&lli->lli_sa_lock); } - if (inode->i_sb->s_root == file->f_dentry) { + if (is_root_inode(inode)) { LUSTRE_FPRIVATE(file) = fd; return 0; } @@ -632,7 +619,7 @@ restart: goto out_openerr; } - ll_release_openhandle(file->f_dentry, it); + ll_release_openhandle(inode, it); } (*och_usecount)++; @@ -652,7 +639,7 @@ restart: result in a deadlock */ mutex_unlock(&lli->lli_och_mutex); it->it_create_mode |= M_CHECK_STALE; - rc = ll_intent_file_open(file, NULL, 0, it); + rc = ll_intent_file_open(file->f_path.dentry, NULL, 0, it); it->it_create_mode &= ~M_CHECK_STALE; if (rc) goto out_openerr; @@ -1065,7 +1052,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, static bool file_is_noatime(const struct file *file) { const struct vfsmount *mnt = file->f_path.mnt; - const struct inode *inode = file->f_path.dentry->d_inode; + const struct inode *inode = file_inode(file); /* Adapted from file_accessed() and touch_atime().*/ if (file->f_flags & O_NOATIME) @@ -1091,7 +1078,7 @@ static bool file_is_noatime(const struct file *file) void ll_io_init(struct cl_io *io, const struct file *file, int write) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK; if (write) { @@ -1117,7 +1104,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, struct file *file, enum cl_io_type iot, loff_t *ppos, size_t count) { - struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode); + struct ll_inode_info *lli = ll_i2info(file_inode(file)); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct cl_io *io; ssize_t result; @@ -1178,20 +1165,20 @@ out: /* If any bit been read/written (result != 0), we just return * short read/write instead of restart io. */ if ((result == 0 || result == -ENODATA) && io->ci_need_restart) { - CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n", + CDEBUG(D_VFSTRACE, "Restart %s on %pD from %lld, count:%zd\n", iot == CIT_READ ? "read" : "write", - file->f_dentry->d_name.name, *ppos, count); + file, *ppos, count); LASSERTF(io->ci_nob == 0, "%zd", io->ci_nob); goto restart; } if (iot == CIT_READ) { if (result >= 0) - ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), + ll_stats_ops_tally(ll_i2sbi(file_inode(file)), LPROC_LL_READ_BYTES, result); } else if (iot == CIT_WRITE) { if (result >= 0) { - ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), + ll_stats_ops_tally(ll_i2sbi(file_inode(file)), LPROC_LL_WRITE_BYTES, result); fd->fd_write_failed = false; } else if (result != -ERESTARTSYS) { @@ -1354,7 +1341,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg) return ll_lov_recreate(inode, &oi, ost_idx); } -int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, +int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, int flags, struct lov_user_md *lum, int lum_size) { struct lov_stripe_md *lsm = NULL; @@ -1371,21 +1358,20 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, } ll_inode_size_lock(inode); - rc = ll_intent_file_open(file, lum, lum_size, &oit); + rc = ll_intent_file_open(dentry, lum, lum_size, &oit); if (rc) goto out_unlock; rc = oit.d.lustre.it_status; if (rc < 0) goto out_req_free; - ll_release_openhandle(file->f_dentry, &oit); + ll_release_openhandle(inode, &oit); out_unlock: ll_inode_size_unlock(inode); ll_intent_release(&oit); ccc_inode_lsm_put(inode, lsm); out: - cl_lov_delay_create_clear(&file->f_flags); return rc; out_req_free: ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data); @@ -1499,7 +1485,9 @@ static int ll_lov_setea(struct inode *inode, struct file *file, return -EFAULT; } - rc = ll_lov_setstripe_ea_info(inode, file, flags, lump, lum_size); + rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lump, + lum_size); + cl_lov_delay_create_clear(&file->f_flags); OBD_FREE_LARGE(lump, lum_size); return rc; @@ -1526,7 +1514,9 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, return -EFAULT; } - rc = ll_lov_setstripe_ea_info(inode, file, flags, lumv1, lum_size); + rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lumv1, + lum_size); + cl_lov_delay_create_clear(&file->f_flags); if (rc == 0) { struct lov_stripe_md *lsm; __u32 gen; @@ -1631,22 +1621,21 @@ int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg) /** * Close inode open handle * - * \param dentry [in] dentry which contains the inode + * \param inode [in] inode in question * \param it [in,out] intent which contains open info and result * * \retval 0 success * \retval <0 failure */ -int ll_release_openhandle(struct dentry *dentry, struct lookup_intent *it) +int ll_release_openhandle(struct inode *inode, struct lookup_intent *it) { - struct inode *inode = dentry->d_inode; struct obd_client_handle *och; int rc; LASSERT(inode); /* Root ? Do nothing. */ - if (dentry->d_inode->i_sb->s_root == dentry) + if (is_root_inode(inode)) return 0; /* No open handle to close? Move away */ @@ -1959,8 +1948,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2, if (!llss) return -ENOMEM; - llss->inode1 = file1->f_dentry->d_inode; - llss->inode2 = file2->f_dentry->d_inode; + llss->inode1 = file_inode(file1); + llss->inode2 = file_inode(file2); if (!S_ISREG(llss->inode2->i_mode)) { rc = -EINVAL; @@ -2092,7 +2081,7 @@ putgl: rc = 0; if (llss->ia2.ia_valid != 0) { mutex_lock(&llss->inode1->i_mutex); - rc = ll_setattr(file1->f_dentry, &llss->ia2); + rc = ll_setattr(file1->f_path.dentry, &llss->ia2); mutex_unlock(&llss->inode1->i_mutex); } @@ -2100,7 +2089,7 @@ putgl: int rc1; mutex_lock(&llss->inode2->i_mutex); - rc1 = ll_setattr(file2->f_dentry, &llss->ia1); + rc1 = ll_setattr(file2->f_path.dentry, &llss->ia1); mutex_unlock(&llss->inode2->i_mutex); if (rc == 0) rc = rc1; @@ -2185,7 +2174,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file, mutex_lock(&inode->i_mutex); - rc = ll_setattr_raw(file->f_dentry, attr, true); + rc = ll_setattr_raw(file->f_path.dentry, attr, true); if (rc == -ENODATA) rc = 0; @@ -2204,7 +2193,7 @@ out: static long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int flags, rc; @@ -2523,7 +2512,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); loff_t retval, eof = 0; retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : @@ -2547,7 +2536,7 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) static int ll_flush(struct file *file, fl_owner_t id) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_inode_info *lli = ll_i2info(inode); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); int rc, err; @@ -2622,16 +2611,9 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, return result; } -/* - * When dentry is provided (the 'else' case), *file->f_dentry may be - * null and dentry must be used directly rather than pulled from - * *file->f_dentry as is done otherwise. - */ - int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) { - struct dentry *dentry = file->f_dentry; - struct inode *inode = dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_inode_info *lli = ll_i2info(inode); struct ptlrpc_request *req; struct obd_capa *oc; @@ -2684,7 +2666,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) static int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct ll_sb_info *sbi = ll_i2sbi(inode); struct ldlm_enqueue_info einfo = { .ei_type = LDLM_FLOCK, @@ -2908,8 +2890,8 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) LASSERT(inode != NULL); - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n", - inode->i_ino, inode->i_generation, inode, dentry->d_name.name); + CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%pd\n", + inode->i_ino, inode->i_generation, inode, dentry); exp = ll_i2mdexp(inode); @@ -3119,7 +3101,7 @@ int ll_inode_permission(struct inode *inode, int mask) /* as root inode are NOT getting validated in lookup operation, * need to do it before permission check. */ - if (inode == inode->i_sb->s_root->d_inode) { + if (is_root_inode(inode)) { rc = __ll_inode_revalidate(inode->i_sb->s_root, MDS_INODELOCK_LOOKUP); if (rc) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 36aa0fd147f2..77d1c12704b4 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -748,7 +748,7 @@ int ll_file_release(struct inode *inode, struct file *file); int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, lstat_t *st); void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch); -int ll_release_openhandle(struct dentry *, struct lookup_intent *); +int ll_release_openhandle(struct inode *, struct lookup_intent *); int ll_md_real_close(struct inode *inode, fmode_t fmode); void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data, struct obd_client_handle **och, unsigned long flags); @@ -763,7 +763,7 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type); int ll_inode_permission(struct inode *inode, int mask); -int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, +int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, int flags, struct lov_user_md *lum, int lum_size); int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, @@ -1413,7 +1413,7 @@ extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, static inline int ll_file_nolock(const struct file *file) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); LASSERT(fd != NULL); return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || @@ -1489,8 +1489,8 @@ static inline void __d_lustre_invalidate(struct dentry *dentry) */ static inline void d_lustre_invalidate(struct dentry *dentry, int nested) { - CDEBUG(D_DENTRY, "invalidate dentry %.*s (%p) parent %p inode %p " - "refc %d\n", dentry->d_name.len, dentry->d_name.name, dentry, + CDEBUG(D_DENTRY, "invalidate dentry %pd (%p) parent %p inode %p " + "refc %d\n", dentry, dentry, dentry->d_parent, dentry->d_inode, d_count(dentry)); spin_lock_nested(&dentry->d_lock, diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index a8bcc51057f1..7b6b9e2e0102 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -698,10 +698,8 @@ void lustre_dump_dentry(struct dentry *dentry, int recur) list_for_each(tmp, &dentry->d_subdirs) subdirs++; - CERROR("dentry %p dump: name=%.*s parent=%.*s (%p), inode=%p, count=%u," - " flags=0x%x, fsdata=%p, %d subdirs\n", dentry, - dentry->d_name.len, dentry->d_name.name, - dentry->d_parent->d_name.len, dentry->d_parent->d_name.name, + CERROR("dentry %p dump: name=%pd parent=%p, inode=%p, count=%u," + " flags=0x%x, fsdata=%p, %d subdirs\n", dentry, dentry, dentry->d_parent, dentry->d_inode, d_count(dentry), dentry->d_flags, dentry->d_fsdata, subdirs); if (dentry->d_inode != NULL) @@ -711,7 +709,7 @@ void lustre_dump_dentry(struct dentry *dentry, int recur) return; list_for_each(tmp, &dentry->d_subdirs) { - struct dentry *d = list_entry(tmp, struct dentry, d_u.d_child); + struct dentry *d = list_entry(tmp, struct dentry, d_child); lustre_dump_dentry(d, recur - 1); } } diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index ae605a6d9dc2..ba1c047ae927 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -100,7 +100,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, unsigned long *ra_flags) { struct file *file = vma->vm_file; - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); struct cl_io *io; struct cl_fault_io *fio; struct lu_env *env; @@ -213,7 +213,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, cfs_restore_sigs(set); if (result == 0) { - struct inode *inode = vma->vm_file->f_dentry->d_inode; + struct inode *inode = file_inode(vma->vm_file); struct ll_inode_info *lli = ll_i2info(inode); lock_page(vmpage); @@ -396,7 +396,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) CWARN("app(%s): the page %lu of file %lu is under heavy" " contention.\n", current->comm, vmf->pgoff, - vma->vm_file->f_dentry->d_inode->i_ino); + file_inode(vma->vm_file)->i_ino); printed = true; } } while (retry); @@ -430,7 +430,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) */ static void ll_vm_open(struct vm_area_struct *vma) { - struct inode *inode = vma->vm_file->f_dentry->d_inode; + struct inode *inode = file_inode(vma->vm_file); struct ccc_object *vob = cl_inode2ccc(inode); LASSERT(vma->vm_file); @@ -443,7 +443,7 @@ static void ll_vm_open(struct vm_area_struct *vma) */ static void ll_vm_close(struct vm_area_struct *vma) { - struct inode *inode = vma->vm_file->f_dentry->d_inode; + struct inode *inode = file_inode(vma->vm_file); struct ccc_object *vob = cl_inode2ccc(inode); LASSERT(vma->vm_file); @@ -476,7 +476,7 @@ static const struct vm_operations_struct ll_file_vm_ops = { int ll_file_mmap(struct file *file, struct vm_area_struct *vma) { - struct inode *inode = file->f_dentry->d_inode; + struct inode *inode = file_inode(file); int rc; if (ll_file_nolock(file)) diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index ae3a12ab7fa1..243a7840457f 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -207,13 +207,15 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen, return LUSTRE_NFS_FID; } -static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen, - loff_t hash, u64 ino, unsigned type) +static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name, + int namelen, loff_t hash, u64 ino, + unsigned type) { /* It is hack to access lde_fid for comparison with lgd_fid. * So the input 'name' must be part of the 'lu_dirent'. */ struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name); - struct ll_getname_data *lgd = cookie; + struct ll_getname_data *lgd = + container_of(ctx, struct ll_getname_data, ctx); struct lu_fid fid; fid_le_to_cpu(&fid, &lde->lde_fid); diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index 264e5ec3fed6..9e31b789b790 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -187,7 +187,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head) { const struct lu_env *env = lo->lo_env; struct cl_io *io = &lo->lo_io; - struct inode *inode = lo->lo_backing_file->f_dentry->d_inode; + struct inode *inode = file_inode(lo->lo_backing_file); struct cl_object *obj = ll_i2info(inode)->lli_clob; pgoff_t offset; int ret; @@ -626,7 +626,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, break; } if (inode == NULL) - inode = lo->lo_backing_file->f_dentry->d_inode; + inode = file_inode(lo->lo_backing_file); if (lo->lo_state == LLOOP_BOUND) fid = ll_i2info(inode)->lli_fid; else @@ -692,8 +692,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file, lo_free = lo; continue; } - if (lo->lo_backing_file->f_dentry->d_inode == - file->f_dentry->d_inode) + if (file_inode(lo->lo_backing_file) == file_inode(file)) break; } if (lo || !lo_free) { diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 7a68c1e027e0..8e926b385a60 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -54,27 +54,6 @@ static int ll_create_it(struct inode *, struct dentry *, int, struct lookup_intent *); -/* - * Check if we have something mounted at the named dchild. - * In such a case there would always be dentry present. - */ -static int ll_d_mountpoint(struct dentry *dparent, struct dentry *dchild, - struct qstr *name) -{ - int mounted = 0; - - if (unlikely(dchild)) { - mounted = d_mountpoint(dchild); - } else if (dparent) { - dchild = d_lookup(dparent, name); - if (dchild) { - mounted = d_mountpoint(dchild); - dput(dchild); - } - } - return mounted; -} - /* called from iget5_locked->find_inode() under inode_hash_lock spinlock */ static int ll_test_inode(struct inode *inode, void *opaque) { @@ -167,14 +146,14 @@ static void ll_invalidate_negative_children(struct inode *dir) struct ll_d_hlist_node *p; ll_lock_dcache(dir); - ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_alias) { + ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) { spin_lock(&dentry->d_lock); if (!list_empty(&dentry->d_subdirs)) { struct dentry *child; list_for_each_entry_safe(child, tmp_subdir, &dentry->d_subdirs, - d_u.d_child) { + d_child) { if (child->d_inode == NULL) d_lustre_invalidate(child, 1); } @@ -285,7 +264,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) && inode->i_sb->s_root != NULL && - inode != inode->i_sb->s_root->d_inode) + is_root_inode(inode)) ll_invalidate_aliases(inode); iput(inode); @@ -362,7 +341,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) discon_alias = invalid_alias = NULL; ll_lock_dcache(inode); - ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_alias) { + ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) { LASSERT(alias != dentry); spin_lock(&alias->d_lock); @@ -509,8 +488,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) return ERR_PTR(-ENAMETOOLONG); - CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n", - dentry->d_name.len, dentry->d_name.name, parent->i_ino, + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),intent=%s\n", + dentry, parent->i_ino, parent->i_generation, parent, LL_IT2STR(it)); if (d_mountpoint(dentry)) @@ -563,7 +542,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, if ((it->it_op & IT_OPEN) && dentry->d_inode && !S_ISREG(dentry->d_inode->i_mode) && !S_ISDIR(dentry->d_inode->i_mode)) { - ll_release_openhandle(dentry, it); + ll_release_openhandle(dentry->d_inode, it); } ll_lookup_finish_locks(it, dentry); @@ -586,8 +565,8 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, struct lookup_intent *itp, it = { .it_op = IT_GETATTR }; struct dentry *de; - CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),flags=%u\n", - dentry->d_name.len, dentry->d_name.name, parent->i_ino, + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),flags=%u\n", + dentry, parent->i_ino, parent->i_generation, parent, flags); /* Optimize away (CREATE && !OPEN). Let .create handle the race. */ @@ -619,9 +598,9 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, long long lookup_flags = LOOKUP_OPEN; int rc = 0; - CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),file %p," + CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),file %p," "open_flags %x,mode %x opened %d\n", - dentry->d_name.len, dentry->d_name.name, dir->i_ino, + dentry, dir->i_ino, dir->i_generation, dir, file, open_flags, mode, *opened); it = kzalloc(sizeof(*it), GFP_NOFS); @@ -741,8 +720,8 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode, struct inode *inode; int rc = 0; |