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;
|
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.
|
* but neither is "reachable" from here.
|
||||||
* So we have our own inline version of it above. :-( */
|
* So we have our own inline version of it above. :-( */
|
||||||
static inline int debugfs_positive(struct dentry *dentry)
|
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,
|
/* Are we still linked,
|
||||||
* or has debugfs_remove() already been called? */
|
* 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: */
|
/* not sure if this can happen: */
|
||||||
if (!parent || !parent->d_inode)
|
if (!parent || !parent->d_inode)
|
||||||
goto out;
|
goto out;
|
||||||
/* serialize with d_delete() */
|
/* serialize with d_delete() */
|
||||||
mutex_lock(&parent->d_inode->i_mutex);
|
mutex_lock(&parent->d_inode->i_mutex);
|
||||||
/* Make sure the object is still alive */
|
/* 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))
|
&& kref_get_unless_zero(kref))
|
||||||
ret = 0;
|
ret = 0;
|
||||||
mutex_unlock(&parent->d_inode->i_mutex);
|
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,
|
lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
|
||||||
size_t nbytes, loff_t *ppos)
|
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;
|
struct lpfc_hba *phba = file->private_data;
|
||||||
char cbuf[32];
|
char cbuf[32];
|
||||||
uint64_t tmp = 0;
|
uint64_t tmp = 0;
|
||||||
|
@ -1052,7 +1052,7 @@ static ssize_t
|
||||||
lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
|
lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
|
||||||
size_t nbytes, loff_t *ppos)
|
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;
|
struct lpfc_hba *phba = file->private_data;
|
||||||
char dstbuf[32];
|
char dstbuf[32];
|
||||||
uint64_t tmp = 0;
|
uint64_t tmp = 0;
|
||||||
|
|
|
@ -2092,7 +2092,7 @@ putgl:
|
||||||
rc = 0;
|
rc = 0;
|
||||||
if (llss->ia2.ia_valid != 0) {
|
if (llss->ia2.ia_valid != 0) {
|
||||||
mutex_lock(&llss->inode1->i_mutex);
|
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);
|
mutex_unlock(&llss->inode1->i_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2100,7 +2100,7 @@ putgl:
|
||||||
int rc1;
|
int rc1;
|
||||||
|
|
||||||
mutex_lock(&llss->inode2->i_mutex);
|
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);
|
mutex_unlock(&llss->inode2->i_mutex);
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
rc = rc1;
|
rc = rc1;
|
||||||
|
@ -2185,7 +2185,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
|
||||||
|
|
||||||
mutex_lock(&inode->i_mutex);
|
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)
|
if (rc == -ENODATA)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
|
@ -2622,12 +2622,6 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
|
||||||
return result;
|
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)
|
int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
|
||||||
{
|
{
|
||||||
struct dentry *dentry = file->f_dentry;
|
struct dentry *dentry = file->f_dentry;
|
||||||
|
|
|
@ -123,7 +123,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,
|
||||||
u32 shared_gen)
|
u32 shared_gen)
|
||||||
{
|
{
|
||||||
struct ceph_file_info *fi = file->private_data;
|
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 inode *dir = parent->d_inode;
|
||||||
struct list_head *p;
|
struct list_head *p;
|
||||||
struct dentry *dentry, *last;
|
struct dentry *dentry, *last;
|
||||||
|
@ -274,7 +274,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
|
||||||
off = 1;
|
off = 1;
|
||||||
}
|
}
|
||||||
if (ctx->pos == 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");
|
dout("readdir off 1 -> '..'\n");
|
||||||
if (!dir_emit(ctx, "..", 2,
|
if (!dir_emit(ctx, "..", 2,
|
||||||
ceph_translate_ino(inode->i_sb, ino),
|
ceph_translate_ino(inode->i_sb, ino),
|
||||||
|
@ -337,7 +337,7 @@ more:
|
||||||
}
|
}
|
||||||
req->r_inode = inode;
|
req->r_inode = inode;
|
||||||
ihold(inode);
|
ihold(inode);
|
||||||
req->r_dentry = dget(file->f_dentry);
|
req->r_dentry = dget(file->f_path.dentry);
|
||||||
/* hints to request -> mds selection code */
|
/* hints to request -> mds selection code */
|
||||||
req->r_direct_mode = USE_AUTH_MDS;
|
req->r_direct_mode = USE_AUTH_MDS;
|
||||||
req->r_direct_hash = ceph_frag_value(frag);
|
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;
|
req->r_num_caps = 1;
|
||||||
if (flags & O_CREAT)
|
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);
|
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
|
||||||
iput(parent_inode);
|
iput(parent_inode);
|
||||||
if (!err)
|
if (!err)
|
||||||
|
|
|
@ -753,7 +753,7 @@ static int cifs_filldir(char *find_entry, struct file *file,
|
||||||
*/
|
*/
|
||||||
fattr.cf_flags |= CIFS_FATTR_NEED_REVAL;
|
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);
|
ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid);
|
||||||
return !dir_emit(ctx, name.name, name.len, ino, fattr.cf_dtype);
|
return !dir_emit(ctx, name.name, name.len, ino, fattr.cf_dtype);
|
||||||
|
|
|
@ -1373,7 +1373,7 @@ out:
|
||||||
int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode)
|
int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode)
|
||||||
{
|
{
|
||||||
struct dentry *lower_dentry =
|
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;
|
ssize_t size;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
void *xattr_virt;
|
void *xattr_virt;
|
||||||
struct dentry *lower_dentry =
|
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;
|
struct inode *lower_inode = lower_dentry->d_inode;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ static ssize_t efivarfs_file_write(struct file *file,
|
||||||
|
|
||||||
if (bytes == -ENOENT) {
|
if (bytes == -ENOENT) {
|
||||||
drop_nlink(inode);
|
drop_nlink(inode);
|
||||||
d_delete(file->f_dentry);
|
d_delete(file->f_path.dentry);
|
||||||
dput(file->f_dentry);
|
dput(file->f_path.dentry);
|
||||||
} else {
|
} else {
|
||||||
mutex_lock(&inode->i_mutex);
|
mutex_lock(&inode->i_mutex);
|
||||||
i_size_write(inode, datasize + sizeof(attributes));
|
i_size_write(inode, datasize + sizeof(attributes));
|
||||||
|
|
|
@ -154,7 +154,7 @@ SYSCALL_DEFINE1(syncfs, int, fd)
|
||||||
|
|
||||||
if (!f.file)
|
if (!f.file)
|
||||||
return -EBADF;
|
return -EBADF;
|
||||||
sb = f.file->f_dentry->d_sb;
|
sb = f.file->f_path.dentry->d_sb;
|
||||||
|
|
||||||
down_read(&sb->s_umount);
|
down_read(&sb->s_umount);
|
||||||
ret = sync_filesystem(sb);
|
ret = sync_filesystem(sb);
|
||||||
|
|
|
@ -367,8 +367,8 @@ struct css_set {
|
||||||
* struct cftype: handler definitions for cgroup control files
|
* struct cftype: handler definitions for cgroup control files
|
||||||
*
|
*
|
||||||
* When reading/writing to a file:
|
* When reading/writing to a file:
|
||||||
* - the cgroup to use is file->f_dentry->d_parent->d_fsdata
|
* - the cgroup to use is file->f_path.dentry->d_parent->d_fsdata
|
||||||
* - the 'cftype' of the file is file->f_dentry->d_fsdata
|
* - the 'cftype' of the file is file->f_path.dentry->d_fsdata
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* cftype->flags */
|
/* cftype->flags */
|
||||||
|
|
|
@ -2373,7 +2373,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
|
||||||
ax->d.next = context->aux;
|
ax->d.next = context->aux;
|
||||||
context->aux = (void *)ax;
|
context->aux = (void *)ax;
|
||||||
|
|
||||||
dentry = dget(bprm->file->f_dentry);
|
dentry = dget(bprm->file->f_path.dentry);
|
||||||
get_vfs_caps_from_disk(dentry, &vcaps);
|
get_vfs_caps_from_disk(dentry, &vcaps);
|
||||||
dput(dentry);
|
dput(dentry);
|
||||||
|
|
||||||
|
|
|
@ -614,7 +614,7 @@ static inline int perf_cgroup_connect(int fd, struct perf_event *event,
|
||||||
if (!f.file)
|
if (!f.file)
|
||||||
return -EBADF;
|
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);
|
&perf_event_cgrp_subsys);
|
||||||
if (IS_ERR(css)) {
|
if (IS_ERR(css)) {
|
||||||
ret = PTR_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);
|
stats = nla_data(na);
|
||||||
memset(stats, 0, sizeof(*stats));
|
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) {
|
if (rc < 0) {
|
||||||
nlmsg_free(rep_skb);
|
nlmsg_free(rep_skb);
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -5055,7 +5055,7 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
|
||||||
*
|
*
|
||||||
* DO NOT ADD NEW FILES.
|
* 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")) {
|
if (!strcmp(name, "memory.usage_in_bytes")) {
|
||||||
event->register_event = mem_cgroup_usage_register_event;
|
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
|
* automatically removed on cgroup destruction but the removal is
|
||||||
* asynchronous, so take an extra ref on @css.
|
* 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);
|
&memory_cgrp_subsys);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
if (IS_ERR(cfile_css))
|
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)
|
if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dentry = dget(bprm->file->f_dentry);
|
dentry = dget(bprm->file->f_path.dentry);
|
||||||
|
|
||||||
rc = get_vfs_caps_from_disk(dentry, &vcaps);
|
rc = get_vfs_caps_from_disk(dentry, &vcaps);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
|
|
@ -196,7 +196,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint,
|
||||||
{
|
{
|
||||||
const char *audit_cause = "failed";
|
const char *audit_cause = "failed";
|
||||||
struct inode *inode = file_inode(file);
|
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;
|
int result = 0;
|
||||||
struct {
|
struct {
|
||||||
struct ima_digest_data hdr;
|
struct ima_digest_data hdr;
|
||||||
|
@ -204,7 +204,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint,
|
||||||
} hash;
|
} hash;
|
||||||
|
|
||||||
if (xattr_value)
|
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)) {
|
if (!(iint->flags & IMA_COLLECTED)) {
|
||||||
u64 i_version = file_inode(file)->i_version;
|
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";
|
static const char op[] = "appraise_data";
|
||||||
char *cause = "unknown";
|
char *cause = "unknown";
|
||||||
struct dentry *dentry = file->f_dentry;
|
struct dentry *dentry = file->f_path.dentry;
|
||||||
struct inode *inode = dentry->d_inode;
|
struct inode *inode = dentry->d_inode;
|
||||||
enum integrity_status status = INTEGRITY_UNKNOWN;
|
enum integrity_status status = INTEGRITY_UNKNOWN;
|
||||||
int rc = xattr_len, hash_start = 0;
|
int rc = xattr_len, hash_start = 0;
|
||||||
|
@ -289,7 +289,7 @@ out:
|
||||||
*/
|
*/
|
||||||
void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
|
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;
|
int rc = 0;
|
||||||
|
|
||||||
/* do not collect and update hash for digital signatures */
|
/* 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) {
|
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);
|
cur_filename_len = strlen(cur_filename);
|
||||||
} else
|
} else
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue