mirror of https://gitee.com/openkylin/linux.git
kill f_dentry uses
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
30e46aba8f
commit
b583043e99
|
@ -419,7 +419,7 @@ static int in_flight_summary_show(struct seq_file *m, void *pos)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* simple_positive(file->f_dentry) respectively debugfs_positive(),
|
||||
/* simple_positive(file->f_path.dentry) respectively debugfs_positive(),
|
||||
* but neither is "reachable" from here.
|
||||
* So we have our own inline version of it above. :-( */
|
||||
static inline int debugfs_positive(struct dentry *dentry)
|
||||
|
@ -437,14 +437,14 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo
|
|||
|
||||
/* Are we still linked,
|
||||
* or has debugfs_remove() already been called? */
|
||||
parent = file->f_dentry->d_parent;
|
||||
parent = file->f_path.dentry->d_parent;
|
||||
/* not sure if this can happen: */
|
||||
if (!parent || !parent->d_inode)
|
||||
goto out;
|
||||
/* serialize with d_delete() */
|
||||
mutex_lock(&parent->d_inode->i_mutex);
|
||||
/* Make sure the object is still alive */
|
||||
if (debugfs_positive(file->f_dentry)
|
||||
if (debugfs_positive(file->f_path.dentry)
|
||||
&& kref_get_unless_zero(kref))
|
||||
ret = 0;
|
||||
mutex_unlock(&parent->d_inode->i_mutex);
|
||||
|
|
|
@ -1011,7 +1011,7 @@ static ssize_t
|
|||
lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
|
||||
size_t nbytes, loff_t *ppos)
|
||||
{
|
||||
struct dentry *dent = file->f_dentry;
|
||||
struct dentry *dent = file->f_path.dentry;
|
||||
struct lpfc_hba *phba = file->private_data;
|
||||
char cbuf[32];
|
||||
uint64_t tmp = 0;
|
||||
|
@ -1052,7 +1052,7 @@ static ssize_t
|
|||
lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
|
||||
size_t nbytes, loff_t *ppos)
|
||||
{
|
||||
struct dentry *dent = file->f_dentry;
|
||||
struct dentry *dent = file->f_path.dentry;
|
||||
struct lpfc_hba *phba = file->private_data;
|
||||
char dstbuf[32];
|
||||
uint64_t tmp = 0;
|
||||
|
|
|
@ -2092,7 +2092,7 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
|
|||
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 +2100,7 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
|
|||
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 +2185,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;
|
||||
|
||||
|
@ -2622,12 +2622,6 @@ 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;
|
||||
|
|
|
@ -123,7 +123,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,
|
|||
u32 shared_gen)
|
||||
{
|
||||
struct ceph_file_info *fi = file->private_data;
|
||||
struct dentry *parent = file->f_dentry;
|
||||
struct dentry *parent = file->f_path.dentry;
|
||||
struct inode *dir = parent->d_inode;
|
||||
struct list_head *p;
|
||||
struct dentry *dentry, *last;
|
||||
|
@ -274,7 +274,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
|
|||
off = 1;
|
||||
}
|
||||
if (ctx->pos == 1) {
|
||||
ino_t ino = parent_ino(file->f_dentry);
|
||||
ino_t ino = parent_ino(file->f_path.dentry);
|
||||
dout("readdir off 1 -> '..'\n");
|
||||
if (!dir_emit(ctx, "..", 2,
|
||||
ceph_translate_ino(inode->i_sb, ino),
|
||||
|
@ -337,7 +337,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
|
|||
}
|
||||
req->r_inode = inode;
|
||||
ihold(inode);
|
||||
req->r_dentry = dget(file->f_dentry);
|
||||
req->r_dentry = dget(file->f_path.dentry);
|
||||
/* hints to request -> mds selection code */
|
||||
req->r_direct_mode = USE_AUTH_MDS;
|
||||
req->r_direct_hash = ceph_frag_value(frag);
|
||||
|
|
|
@ -211,7 +211,7 @@ int ceph_open(struct inode *inode, struct file *file)
|
|||
|
||||
req->r_num_caps = 1;
|
||||
if (flags & O_CREAT)
|
||||
parent_inode = ceph_get_dentry_parent_inode(file->f_dentry);
|
||||
parent_inode = ceph_get_dentry_parent_inode(file->f_path.dentry);
|
||||
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
|
||||
iput(parent_inode);
|
||||
if (!err)
|
||||
|
|
|
@ -753,7 +753,7 @@ static int cifs_filldir(char *find_entry, struct file *file,
|
|||
*/
|
||||
fattr.cf_flags |= CIFS_FATTR_NEED_REVAL;
|
||||
|
||||
cifs_prime_dcache(file->f_dentry, &name, &fattr);
|
||||
cifs_prime_dcache(file->f_path.dentry, &name, &fattr);
|
||||
|
||||
ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid);
|
||||
return !dir_emit(ctx, name.name, name.len, ino, fattr.cf_dtype);
|
||||
|
|
|
@ -1373,7 +1373,7 @@ static int ecryptfs_read_headers_virt(char *page_virt,
|
|||
int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode)
|
||||
{
|
||||
struct dentry *lower_dentry =
|
||||
ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_dentry;
|
||||
ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_path.dentry;
|
||||
ssize_t size;
|
||||
int rc = 0;
|
||||
|
||||
|
|
|
@ -419,7 +419,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
|
|||
ssize_t size;
|
||||
void *xattr_virt;
|
||||
struct dentry *lower_dentry =
|
||||
ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_dentry;
|
||||
ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_path.dentry;
|
||||
struct inode *lower_inode = lower_dentry->d_inode;
|
||||
int rc;
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ static ssize_t efivarfs_file_write(struct file *file,
|
|||
|
||||
if (bytes == -ENOENT) {
|
||||
drop_nlink(inode);
|
||||
d_delete(file->f_dentry);
|
||||
dput(file->f_dentry);
|
||||
d_delete(file->f_path.dentry);
|
||||
dput(file->f_path.dentry);
|
||||
} else {
|
||||
mutex_lock(&inode->i_mutex);
|
||||
i_size_write(inode, datasize + sizeof(attributes));
|
||||
|
|
|
@ -154,7 +154,7 @@ SYSCALL_DEFINE1(syncfs, int, fd)
|
|||
|
||||
if (!f.file)
|
||||
return -EBADF;
|
||||
sb = f.file->f_dentry->d_sb;
|
||||
sb = f.file->f_path.dentry->d_sb;
|
||||
|
||||
down_read(&sb->s_umount);
|
||||
ret = sync_filesystem(sb);
|
||||
|
|
|
@ -367,8 +367,8 @@ struct css_set {
|
|||
* struct cftype: handler definitions for cgroup control files
|
||||
*
|
||||
* When reading/writing to a file:
|
||||
* - the cgroup to use is file->f_dentry->d_parent->d_fsdata
|
||||
* - the 'cftype' of the file is file->f_dentry->d_fsdata
|
||||
* - the cgroup to use is file->f_path.dentry->d_parent->d_fsdata
|
||||
* - the 'cftype' of the file is file->f_path.dentry->d_fsdata
|
||||
*/
|
||||
|
||||
/* cftype->flags */
|
||||
|
|
|
@ -2373,7 +2373,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
|
|||
ax->d.next = context->aux;
|
||||
context->aux = (void *)ax;
|
||||
|
||||
dentry = dget(bprm->file->f_dentry);
|
||||
dentry = dget(bprm->file->f_path.dentry);
|
||||
get_vfs_caps_from_disk(dentry, &vcaps);
|
||||
dput(dentry);
|
||||
|
||||
|
|
|
@ -614,7 +614,7 @@ static inline int perf_cgroup_connect(int fd, struct perf_event *event,
|
|||
if (!f.file)
|
||||
return -EBADF;
|
||||
|
||||
css = css_tryget_online_from_dir(f.file->f_dentry,
|
||||
css = css_tryget_online_from_dir(f.file->f_path.dentry,
|
||||
&perf_event_cgrp_subsys);
|
||||
if (IS_ERR(css)) {
|
||||
ret = PTR_ERR(css);
|
||||
|
|
|
@ -459,7 +459,7 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
|
|||
stats = nla_data(na);
|
||||
memset(stats, 0, sizeof(*stats));
|
||||
|
||||
rc = cgroupstats_build(stats, f.file->f_dentry);
|
||||
rc = cgroupstats_build(stats, f.file->f_path.dentry);
|
||||
if (rc < 0) {
|
||||
nlmsg_free(rep_skb);
|
||||
goto err;
|
||||
|
|
|
@ -5055,7 +5055,7 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
|
|||
*
|
||||
* DO NOT ADD NEW FILES.
|
||||
*/
|
||||
name = cfile.file->f_dentry->d_name.name;
|
||||
name = cfile.file->f_path.dentry->d_name.name;
|
||||
|
||||
if (!strcmp(name, "memory.usage_in_bytes")) {
|
||||
event->register_event = mem_cgroup_usage_register_event;
|
||||
|
@ -5079,7 +5079,7 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
|
|||
* automatically removed on cgroup destruction but the removal is
|
||||
* asynchronous, so take an extra ref on @css.
|
||||
*/
|
||||
cfile_css = css_tryget_online_from_dir(cfile.file->f_dentry->d_parent,
|
||||
cfile_css = css_tryget_online_from_dir(cfile.file->f_path.dentry->d_parent,
|
||||
&memory_cgrp_subsys);
|
||||
ret = -EINVAL;
|
||||
if (IS_ERR(cfile_css))
|
||||
|
|
|
@ -446,7 +446,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c
|
|||
if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
|
||||
return 0;
|
||||
|
||||
dentry = dget(bprm->file->f_dentry);
|
||||
dentry = dget(bprm->file->f_path.dentry);
|
||||
|
||||
rc = get_vfs_caps_from_disk(dentry, &vcaps);
|
||||
if (rc < 0) {
|
||||
|
|
|
@ -196,7 +196,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint,
|
|||
{
|
||||
const char *audit_cause = "failed";
|
||||
struct inode *inode = file_inode(file);
|
||||
const char *filename = file->f_dentry->d_name.name;
|
||||
const char *filename = file->f_path.dentry->d_name.name;
|
||||
int result = 0;
|
||||
struct {
|
||||
struct ima_digest_data hdr;
|
||||
|
@ -204,7 +204,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint,
|
|||
} hash;
|
||||
|
||||
if (xattr_value)
|
||||
*xattr_len = ima_read_xattr(file->f_dentry, xattr_value);
|
||||
*xattr_len = ima_read_xattr(file->f_path.dentry, xattr_value);
|
||||
|
||||
if (!(iint->flags & IMA_COLLECTED)) {
|
||||
u64 i_version = file_inode(file)->i_version;
|
||||
|
|
|
@ -189,7 +189,7 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint,
|
|||
{
|
||||
static const char op[] = "appraise_data";
|
||||
char *cause = "unknown";
|
||||
struct dentry *dentry = file->f_dentry;
|
||||
struct dentry *dentry = file->f_path.dentry;
|
||||
struct inode *inode = dentry->d_inode;
|
||||
enum integrity_status status = INTEGRITY_UNKNOWN;
|
||||
int rc = xattr_len, hash_start = 0;
|
||||
|
@ -289,7 +289,7 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint,
|
|||
*/
|
||||
void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
|
||||
{
|
||||
struct dentry *dentry = file->f_dentry;
|
||||
struct dentry *dentry = file->f_path.dentry;
|
||||
int rc = 0;
|
||||
|
||||
/* do not collect and update hash for digital signatures */
|
||||
|
|
|
@ -284,7 +284,7 @@ static int ima_eventname_init_common(struct integrity_iint_cache *iint,
|
|||
}
|
||||
|
||||
if (file) {
|
||||
cur_filename = file->f_dentry->d_name.name;
|
||||
cur_filename = file->f_path.dentry->d_name.name;
|
||||
cur_filename_len = strlen(cur_filename);
|
||||
} else
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue