mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile (part one) from Al Viro: "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent locking violations, etc. The most visible changes here are death of FS_REVAL_DOT (replaced with "has ->d_weak_revalidate()") and a new helper getting from struct file to inode. Some bits of preparation to xattr method interface changes. Misc patches by various people sent this cycle *and* ocfs2 fixes from several cycles ago that should've been upstream right then. PS: the next vfs pile will be xattr stuff." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits) saner proc_get_inode() calling conventions proc: avoid extra pde_put() in proc_fill_super() fs: change return values from -EACCES to -EPERM fs/exec.c: make bprm_mm_init() static ocfs2/dlm: use GFP_ATOMIC inside a spin_lock ocfs2: fix possible use-after-free with AIO ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero target: writev() on single-element vector is pointless export kernel_write(), convert open-coded instances fs: encode_fh: return FILEID_INVALID if invalid fid_type kill f_vfsmnt vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op nfsd: handle vfs_getattr errors in acl protocol switch vfs_getattr() to struct path default SET_PERSONALITY() in linux/elf.h ceph: prepopulate inodes only when request is aborted d_hash_and_lookup(): export, switch open-coded instances 9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate() 9p: split dropping the acls from v9fs_set_create_acl() ...
This commit is contained in:
commit
d895cb1af1
383 changed files with 1276 additions and 1423 deletions
37
fs/9p/acl.c
37
fs/9p/acl.c
|
|
@ -23,6 +23,7 @@
|
|||
#include "acl.h"
|
||||
#include "v9fs.h"
|
||||
#include "v9fs_vfs.h"
|
||||
#include "fid.h"
|
||||
|
||||
static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name)
|
||||
{
|
||||
|
|
@ -113,16 +114,12 @@ struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
|
|||
|
||||
}
|
||||
|
||||
static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
|
||||
static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
|
||||
{
|
||||
int retval;
|
||||
char *name;
|
||||
size_t size;
|
||||
void *buffer;
|
||||
struct inode *inode = dentry->d_inode;
|
||||
|
||||
set_cached_acl(inode, type, acl);
|
||||
|
||||
if (!acl)
|
||||
return 0;
|
||||
|
||||
|
|
@ -144,17 +141,16 @@ static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
|
|||
default:
|
||||
BUG();
|
||||
}
|
||||
retval = v9fs_xattr_set(dentry, name, buffer, size, 0);
|
||||
retval = v9fs_fid_xattr_set(fid, name, buffer, size, 0);
|
||||
err_free_out:
|
||||
kfree(buffer);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int v9fs_acl_chmod(struct dentry *dentry)
|
||||
int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
|
||||
{
|
||||
int retval = 0;
|
||||
struct posix_acl *acl;
|
||||
struct inode *inode = dentry->d_inode;
|
||||
|
||||
if (S_ISLNK(inode->i_mode))
|
||||
return -EOPNOTSUPP;
|
||||
|
|
@ -163,25 +159,30 @@ int v9fs_acl_chmod(struct dentry *dentry)
|
|||
retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
|
||||
if (retval)
|
||||
return retval;
|
||||
retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, acl);
|
||||
set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
|
||||
retval = v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
|
||||
posix_acl_release(acl);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int v9fs_set_create_acl(struct dentry *dentry,
|
||||
struct posix_acl **dpacl, struct posix_acl **pacl)
|
||||
int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
|
||||
struct posix_acl *dacl, struct posix_acl *acl)
|
||||
{
|
||||
if (dentry) {
|
||||
v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, *dpacl);
|
||||
v9fs_set_acl(dentry, ACL_TYPE_ACCESS, *pacl);
|
||||
}
|
||||
posix_acl_release(*dpacl);
|
||||
posix_acl_release(*pacl);
|
||||
*dpacl = *pacl = NULL;
|
||||
set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl);
|
||||
set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
|
||||
v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl);
|
||||
v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void v9fs_put_acl(struct posix_acl *dacl,
|
||||
struct posix_acl *acl)
|
||||
{
|
||||
posix_acl_release(dacl);
|
||||
posix_acl_release(acl);
|
||||
}
|
||||
|
||||
int v9fs_acl_mode(struct inode *dir, umode_t *modep,
|
||||
struct posix_acl **dpacl, struct posix_acl **pacl)
|
||||
{
|
||||
|
|
|
|||
20
fs/9p/acl.h
20
fs/9p/acl.h
|
|
@ -17,27 +17,33 @@
|
|||
#ifdef CONFIG_9P_FS_POSIX_ACL
|
||||
extern int v9fs_get_acl(struct inode *, struct p9_fid *);
|
||||
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
|
||||
extern int v9fs_acl_chmod(struct dentry *);
|
||||
extern int v9fs_set_create_acl(struct dentry *,
|
||||
struct posix_acl **, struct posix_acl **);
|
||||
extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
|
||||
extern int v9fs_set_create_acl(struct inode *, struct p9_fid *,
|
||||
struct posix_acl *, struct posix_acl *);
|
||||
extern int v9fs_acl_mode(struct inode *dir, umode_t *modep,
|
||||
struct posix_acl **dpacl, struct posix_acl **pacl);
|
||||
extern void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl);
|
||||
#else
|
||||
#define v9fs_iop_get_acl NULL
|
||||
static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int v9fs_acl_chmod(struct dentry *dentry)
|
||||
static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int v9fs_set_create_acl(struct dentry *dentry,
|
||||
struct posix_acl **dpacl,
|
||||
struct posix_acl **pacl)
|
||||
static inline int v9fs_set_create_acl(struct inode *inode,
|
||||
struct p9_fid *fid,
|
||||
struct posix_acl *dacl,
|
||||
struct posix_acl *acl)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void v9fs_put_acl(struct posix_acl *dacl,
|
||||
struct posix_acl *acl)
|
||||
{
|
||||
}
|
||||
static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep,
|
||||
struct posix_acl **dpacl,
|
||||
struct posix_acl **pacl)
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ out_valid:
|
|||
|
||||
const struct dentry_operations v9fs_cached_dentry_operations = {
|
||||
.d_revalidate = v9fs_lookup_revalidate,
|
||||
.d_weak_revalidate = v9fs_lookup_revalidate,
|
||||
.d_delete = v9fs_cached_dentry_delete,
|
||||
.d_release = v9fs_dentry_release,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ out_error:
|
|||
static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
|
||||
{
|
||||
int res = 0;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
|
||||
p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
|
||||
|
||||
|
|
@ -298,7 +298,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl)
|
|||
|
||||
static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
int ret = -ENOLCK;
|
||||
|
||||
p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
|
||||
|
|
@ -334,7 +334,7 @@ out_err:
|
|||
static int v9fs_file_flock_dotl(struct file *filp, int cmd,
|
||||
struct file_lock *fl)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
int ret = -ENOLCK;
|
||||
|
||||
p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
|
||||
|
|
@ -525,7 +525,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
|
|||
if (!count)
|
||||
goto out;
|
||||
|
||||
retval = v9fs_file_write_internal(filp->f_path.dentry->d_inode,
|
||||
retval = v9fs_file_write_internal(file_inode(filp),
|
||||
filp->private_data,
|
||||
data, count, &origin, 1);
|
||||
/* update offset on successful write */
|
||||
|
|
@ -600,7 +600,7 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
|||
struct v9fs_inode *v9inode;
|
||||
struct page *page = vmf->page;
|
||||
struct file *filp = vma->vm_file;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
|
||||
|
||||
p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n",
|
||||
|
|
|
|||
|
|
@ -330,14 +330,14 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
|
|||
p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
|
||||
goto error;
|
||||
}
|
||||
/* Now set the ACL based on the default value */
|
||||
v9fs_set_create_acl(inode, fid, dacl, pacl);
|
||||
|
||||
err = v9fs_fid_add(dentry, fid);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
d_instantiate(dentry, inode);
|
||||
|
||||
/* Now set the ACL based on the default value */
|
||||
v9fs_set_create_acl(dentry, &dacl, &pacl);
|
||||
|
||||
v9inode = V9FS_I(inode);
|
||||
mutex_lock(&v9inode->v_mutex);
|
||||
if (v9ses->cache && !v9inode->writeback_fid &&
|
||||
|
|
@ -369,6 +369,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
|
|||
#endif
|
||||
*opened |= FILE_CREATED;
|
||||
out:
|
||||
v9fs_put_acl(dacl, pacl);
|
||||
dput(res);
|
||||
return err;
|
||||
|
||||
|
|
@ -378,7 +379,6 @@ error:
|
|||
err_clunk_old_fid:
|
||||
if (ofid)
|
||||
p9_client_clunk(ofid);
|
||||
v9fs_set_create_acl(NULL, &dacl, &pacl);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -435,17 +435,17 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
|
|||
if (err < 0)
|
||||
goto error;
|
||||
|
||||
fid = p9_client_walk(dfid, 1, &name, 1);
|
||||
if (IS_ERR(fid)) {
|
||||
err = PTR_ERR(fid);
|
||||
p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
|
||||
err);
|
||||
fid = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* instantiate inode and assign the unopened fid to the dentry */
|
||||
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
|
||||
fid = p9_client_walk(dfid, 1, &name, 1);
|
||||
if (IS_ERR(fid)) {
|
||||
err = PTR_ERR(fid);
|
||||
p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
|
||||
err);
|
||||
fid = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
|
||||
if (IS_ERR(inode)) {
|
||||
err = PTR_ERR(inode);
|
||||
|
|
@ -456,6 +456,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
|
|||
err = v9fs_fid_add(dentry, fid);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
v9fs_set_create_acl(inode, fid, dacl, pacl);
|
||||
d_instantiate(dentry, inode);
|
||||
fid = NULL;
|
||||
} else {
|
||||
|
|
@ -469,16 +470,15 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
|
|||
err = PTR_ERR(inode);
|
||||
goto error;
|
||||
}
|
||||
v9fs_set_create_acl(inode, fid, dacl, pacl);
|
||||
d_instantiate(dentry, inode);
|
||||
}
|
||||
/* Now set the ACL based on the default value */
|
||||
v9fs_set_create_acl(dentry, &dacl, &pacl);
|
||||
inc_nlink(dir);
|
||||
v9fs_invalidate_inode_attr(dir);
|
||||
error:
|
||||
if (fid)
|
||||
p9_client_clunk(fid);
|
||||
v9fs_set_create_acl(NULL, &dacl, &pacl);
|
||||
v9fs_put_acl(dacl, pacl);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -572,10 +572,11 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
|
|||
struct v9fs_session_info *v9ses;
|
||||
struct p9_fid *fid;
|
||||
struct p9_iattr_dotl p9attr;
|
||||
struct inode *inode = dentry->d_inode;
|
||||
|
||||
p9_debug(P9_DEBUG_VFS, "\n");
|
||||
|
||||
retval = inode_change_ok(dentry->d_inode, iattr);
|
||||
retval = inode_change_ok(inode, iattr);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
|
|
@ -596,23 +597,23 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
|
|||
return PTR_ERR(fid);
|
||||
|
||||
/* Write all dirty data */
|
||||
if (S_ISREG(dentry->d_inode->i_mode))
|
||||
filemap_write_and_wait(dentry->d_inode->i_mapping);
|
||||
if (S_ISREG(inode->i_mode))
|
||||
filemap_write_and_wait(inode->i_mapping);
|
||||
|
||||
retval = p9_client_setattr(fid, &p9attr);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
if ((iattr->ia_valid & ATTR_SIZE) &&
|
||||
iattr->ia_size != i_size_read(dentry->d_inode))
|
||||
truncate_setsize(dentry->d_inode, iattr->ia_size);
|
||||
iattr->ia_size != i_size_read(inode))
|
||||
truncate_setsize(inode, iattr->ia_size);
|
||||
|
||||
v9fs_invalidate_inode_attr(dentry->d_inode);
|
||||
setattr_copy(dentry->d_inode, iattr);
|
||||
mark_inode_dirty(dentry->d_inode);
|
||||
v9fs_invalidate_inode_attr(inode);
|
||||
setattr_copy(inode, iattr);
|
||||
mark_inode_dirty(inode);
|
||||
if (iattr->ia_valid & ATTR_MODE) {
|
||||
/* We also want to update ACL when we update mode bits */
|
||||
retval = v9fs_acl_chmod(dentry);
|
||||
retval = v9fs_acl_chmod(inode, fid);
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -880,17 +881,17 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
|
|||
goto error;
|
||||
|
||||
v9fs_invalidate_inode_attr(dir);
|
||||
fid = p9_client_walk(dfid, 1, &name, 1);
|
||||
if (IS_ERR(fid)) {
|
||||
err = PTR_ERR(fid);
|
||||
p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
|
||||
err);
|
||||
fid = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* instantiate inode and assign the unopened fid to the dentry */
|
||||
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
|
||||
fid = p9_client_walk(dfid, 1, &name, 1);
|
||||
if (IS_ERR(fid)) {
|
||||
err = PTR_ERR(fid);
|
||||
p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
|
||||
err);
|
||||
fid = NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
|
||||
if (IS_ERR(inode)) {
|
||||
err = PTR_ERR(inode);
|
||||
|
|
@ -898,6 +899,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
|
|||
err);
|
||||
goto error;
|
||||
}
|
||||
v9fs_set_create_acl(inode, fid, dacl, pacl);
|
||||
err = v9fs_fid_add(dentry, fid);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
|
@ -913,14 +915,13 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
|
|||
err = PTR_ERR(inode);
|
||||
goto error;
|
||||
}
|
||||
v9fs_set_create_acl(inode, fid, dacl, pacl);
|
||||
d_instantiate(dentry, inode);
|
||||
}
|
||||
/* Now set the ACL based on the default value */
|
||||
v9fs_set_create_acl(dentry, &dacl, &pacl);
|
||||
error:
|
||||
if (fid)
|
||||
p9_client_clunk(fid);
|
||||
v9fs_set_create_acl(NULL, &dacl, &pacl);
|
||||
v9fs_put_acl(dacl, pacl);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -363,5 +363,5 @@ struct file_system_type v9fs_fs_type = {
|
|||
.mount = v9fs_mount,
|
||||
.kill_sb = v9fs_kill_super,
|
||||
.owner = THIS_MODULE,
|
||||
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT,
|
||||
.fs_flags = FS_RENAME_DOES_D_MOVE,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -110,20 +110,27 @@ ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name,
|
|||
*/
|
||||
int v9fs_xattr_set(struct dentry *dentry, const char *name,
|
||||
const void *value, size_t value_len, int flags)
|
||||
{
|
||||
struct p9_fid *fid = v9fs_fid_lookup(dentry);
|
||||
if (IS_ERR(fid))
|
||||
return PTR_ERR(fid);
|
||||
return v9fs_fid_xattr_set(fid, name, value, value_len, flags);
|
||||
}
|
||||
|
||||
int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
|
||||
const void *value, size_t value_len, int flags)
|
||||
{
|
||||
u64 offset = 0;
|
||||
int retval, msize, write_count;
|
||||
struct p9_fid *fid = NULL;
|
||||
|
||||
p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n",
|
||||
name, value_len, flags);
|
||||
|
||||
fid = v9fs_fid_clone(dentry);
|
||||
if (IS_ERR(fid)) {
|
||||
retval = PTR_ERR(fid);
|
||||
fid = NULL;
|
||||
goto error;
|
||||
}
|
||||
/* Clone it */
|
||||
fid = p9_client_walk(fid, 0, NULL, 1);
|
||||
if (IS_ERR(fid))
|
||||
return PTR_ERR(fid);
|
||||
|
||||
/*
|
||||
* On success fid points to xattr
|
||||
*/
|
||||
|
|
@ -131,7 +138,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
|
|||
if (retval < 0) {
|
||||
p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
|
||||
retval);
|
||||
goto error;
|
||||
p9_client_clunk(fid);
|
||||
return retval;
|
||||
}
|
||||
msize = fid->clnt->msize;
|
||||
while (value_len) {
|
||||
|
|
@ -144,17 +152,12 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
|
|||
if (write_count < 0) {
|
||||
/* error in xattr write */
|
||||
retval = write_count;
|
||||
goto error;
|
||||
break;
|
||||
}
|
||||
offset += write_count;
|
||||
value_len -= write_count;
|
||||
}
|
||||
/* Total read xattr bytes */
|
||||
retval = offset;
|
||||
error:
|
||||
if (fid)
|
||||
retval = p9_client_clunk(fid);
|
||||
return retval;
|
||||
return p9_client_clunk(fid);
|
||||
}
|
||||
|
||||
ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ extern ssize_t v9fs_fid_xattr_get(struct p9_fid *, const char *,
|
|||
void *, size_t);
|
||||
extern ssize_t v9fs_xattr_get(struct dentry *, const char *,
|
||||
void *, size_t);
|
||||
extern int v9fs_fid_xattr_set(struct p9_fid *, const char *,
|
||||
const void *, size_t, int);
|
||||
extern int v9fs_xattr_set(struct dentry *, const char *,
|
||||
const void *, size_t, int);
|
||||
extern ssize_t v9fs_listxattr(struct dentry *, char *, size_t);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ static DEFINE_RWLOCK(adfs_dir_lock);
|
|||
static int
|
||||
adfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;
|
||||
struct object_info obj;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const struct inode_operations affs_dir_inode_operations = {
|
|||
static int
|
||||
affs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct buffer_head *dir_bh;
|
||||
struct buffer_head *fh_bh;
|
||||
|
|
|
|||
|
|
@ -393,12 +393,12 @@ static int afs_readdir(struct file *file, void *cookie, filldir_t filldir)
|
|||
int ret;
|
||||
|
||||
_enter("{%Ld,{%lu}}",
|
||||
file->f_pos, file->f_path.dentry->d_inode->i_ino);
|
||||
file->f_pos, file_inode(file)->i_ino);
|
||||
|
||||
ASSERT(file->private_data != NULL);
|
||||
|
||||
fpos = file->f_pos;
|
||||
ret = afs_dir_iterate(file->f_path.dentry->d_inode, &fpos,
|
||||
ret = afs_dir_iterate(file_inode(file), &fpos,
|
||||
cookie, filldir, file->private_data);
|
||||
file->f_pos = fpos;
|
||||
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ error:
|
|||
*/
|
||||
int afs_lock(struct file *file, int cmd, struct file_lock *fl)
|
||||
{
|
||||
struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
|
||||
struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
|
||||
|
||||
_enter("{%x:%u},%d,{t=%x,fl=%x,r=%Ld:%Ld}",
|
||||
vnode->fid.vid, vnode->fid.vnode, cmd,
|
||||
|
|
@ -537,7 +537,7 @@ int afs_lock(struct file *file, int cmd, struct file_lock *fl)
|
|||
*/
|
||||
int afs_flock(struct file *file, int cmd, struct file_lock *fl)
|
||||
{
|
||||
struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
|
||||
struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
|
||||
|
||||
_enter("{%x:%u},%d,{t=%x,fl=%x}",
|
||||
vnode->fid.vid, vnode->fid.vnode, cmd,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping,
|
|||
struct page **pagep, void **fsdata)
|
||||
{
|
||||
struct afs_writeback *candidate, *wb;
|
||||
struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
|
||||
struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
|
||||
struct page *page;
|
||||
struct key *key = file->private_data;
|
||||
unsigned from = pos & (PAGE_CACHE_SIZE - 1);
|
||||
|
|
@ -245,7 +245,7 @@ int afs_write_end(struct file *file, struct address_space *mapping,
|
|||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct page *page, void *fsdata)
|
||||
{
|
||||
struct afs_vnode *vnode = AFS_FS_I(file->f_dentry->d_inode);
|
||||
struct afs_vnode *vnode = AFS_FS_I(file_inode(file));
|
||||
loff_t i_size, maybe_i_size;
|
||||
|
||||
_enter("{%x:%u},{%lx}",
|
||||
|
|
@ -627,8 +627,7 @@ void afs_pages_written_back(struct afs_vnode *vnode, struct afs_call *call)
|
|||
ssize_t afs_file_write(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos)
|
||||
{
|
||||
struct dentry *dentry = iocb->ki_filp->f_path.dentry;
|
||||
struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode);
|
||||
struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp));
|
||||
ssize_t result;
|
||||
size_t count = iov_length(iov, nr_segs);
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ struct file *anon_inode_getfile(const char *name,
|
|||
struct qstr this;
|
||||
struct path path;
|
||||
struct file *file;
|
||||
int error;
|
||||
|
||||
if (IS_ERR(anon_inode_inode))
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
|
@ -143,7 +142,7 @@ struct file *anon_inode_getfile(const char *name,
|
|||
* Link the inode to a directory entry by creating a unique name
|
||||
* using the inode sequence number.
|
||||
*/
|
||||
error = -ENOMEM;
|
||||
file = ERR_PTR(-ENOMEM);
|
||||
this.name = name;
|
||||
this.len = strlen(name);
|
||||
this.hash = 0;
|
||||
|
|
@ -160,15 +159,12 @@ struct file *anon_inode_getfile(const char *name,
|
|||
|
||||
d_instantiate(path.dentry, anon_inode_inode);
|
||||
|
||||
error = -ENFILE;
|
||||
file = alloc_file(&path, OPEN_FMODE(flags), fops);
|
||||
if (!file)
|
||||
if (IS_ERR(file))
|
||||
goto err_dput;
|
||||
file->f_mapping = anon_inode_inode->i_mapping;
|
||||
|
||||
file->f_pos = 0;
|
||||
file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
|
||||
file->f_version = 0;
|
||||
file->private_data = priv;
|
||||
|
||||
return file;
|
||||
|
|
@ -177,7 +173,7 @@ err_dput:
|
|||
path_put(&path);
|
||||
err_module:
|
||||
module_put(fops->owner);
|
||||
return ERR_PTR(error);
|
||||
return file;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(anon_inode_getfile);
|
||||
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ static inline int autofs_prepare_pipe(struct file *pipe)
|
|||
{
|
||||
if (!pipe->f_op || !pipe->f_op->write)
|
||||
return -EINVAL;
|
||||
if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode))
|
||||
if (!S_ISFIFO(file_inode(pipe)->i_mode))
|
||||
return -EINVAL;
|
||||
/* We want a packet pipe */
|
||||
pipe->f_flags |= O_DIRECT;
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ static struct autofs_sb_info *autofs_dev_ioctl_sbi(struct file *f)
|
|||
struct inode *inode;
|
||||
|
||||
if (f) {
|
||||
inode = f->f_path.dentry->d_inode;
|
||||
inode = file_inode(f);
|
||||
sbi = autofs4_sbi(inode->i_sb);
|
||||
}
|
||||
return sbi;
|
||||
|
|
|
|||
|
|
@ -587,7 +587,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
|
|||
|
||||
/* This allows root to remove symlinks */
|
||||
if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (atomic_dec_and_test(&ino->count)) {
|
||||
p_ino = autofs4_dentry_ino(dentry->d_parent);
|
||||
|
|
@ -874,7 +874,7 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp,
|
|||
static long autofs4_root_ioctl(struct file *filp,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg);
|
||||
}
|
||||
|
||||
|
|
@ -882,7 +882,7 @@ static long autofs4_root_ioctl(struct file *filp,
|
|||
static long autofs4_root_compat_ioctl(struct file *filp,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
int ret;
|
||||
|
||||
if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL)
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
|
|||
static int
|
||||
befs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
|
||||
befs_off_t value;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ static struct buffer_head *bfs_find_entry(struct inode *dir,
|
|||
|
||||
static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *dir = f->f_path.dentry->d_inode;
|
||||
struct inode *dir = file_inode(f);
|
||||
struct buffer_head *bh;
|
||||
struct bfs_dirent *de;
|
||||
struct bfs_sb_info *info = BFS_SB(dir->i_sb);
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ static int load_aout_binary(struct linux_binprm * bprm)
|
|||
if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC &&
|
||||
N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) ||
|
||||
N_TRSIZE(ex) || N_DRSIZE(ex) ||
|
||||
i_size_read(bprm->file->f_path.dentry->d_inode) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
|
||||
i_size_read(file_inode(bprm->file)) < ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) {
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ static int load_aout_library(struct file *file)
|
|||
int retval;
|
||||
struct exec ex;
|
||||
|
||||
inode = file->f_path.dentry->d_inode;
|
||||
inode = file_inode(file);
|
||||
|
||||
retval = -ENOEXEC;
|
||||
error = kernel_read(file, 0, (char *) &ex, sizeof(ex));
|
||||
|
|
|
|||
|
|
@ -1141,7 +1141,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
|
|||
|
||||
/* By default, dump shared memory if mapped from an anonymous file. */
|
||||
if (vma->vm_flags & VM_SHARED) {
|
||||
if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0 ?
|
||||
if (file_inode(vma->vm_file)->i_nlink == 0 ?
|
||||
FILTER(ANON_SHARED) : FILTER(MAPPED_SHARED))
|
||||
goto whole;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -909,7 +909,7 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params,
|
|||
|
||||
dynamic_error:
|
||||
printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n",
|
||||
what, file->f_path.dentry->d_inode->i_ino);
|
||||
what, file_inode(file)->i_ino);
|
||||
return -ELIBBAD;
|
||||
}
|
||||
|
||||
|
|
@ -1219,7 +1219,7 @@ static int maydump(struct vm_area_struct *vma, unsigned long mm_flags)
|
|||
|
||||
/* By default, dump shared memory if mapped from an anonymous file. */
|
||||
if (vma->vm_flags & VM_SHARED) {
|
||||
if (vma->vm_file->f_path.dentry->d_inode->i_nlink == 0) {
|
||||
if (file_inode(vma->vm_file)->i_nlink == 0) {
|
||||
dump_ok = test_bit(MMF_DUMP_ANON_SHARED, &mm_flags);
|
||||
kdcore("%08lx: %08lx: %s (share)", vma->vm_start,
|
||||
vma->vm_flags, dump_ok ? "yes" : "no");
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ static int load_flat_file(struct linux_binprm * bprm,
|
|||
int ret;
|
||||
|
||||
hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */
|
||||
inode = bprm->file->f_path.dentry->d_inode;
|
||||
inode = file_inode(bprm->file);
|
||||
|
||||
text_len = ntohl(hdr->data_start);
|
||||
data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start);
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ static void kill_node(Node *e)
|
|||
static ssize_t
|
||||
bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
|
||||
{
|
||||
Node *e = file->f_path.dentry->d_inode->i_private;
|
||||
Node *e = file_inode(file)->i_private;
|
||||
ssize_t res;
|
||||
char *page;
|
||||
|
||||
|
|
@ -550,7 +550,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct dentry *root;
|
||||
Node *e = file->f_path.dentry->d_inode->i_private;
|
||||
Node *e = file_inode(file)->i_private;
|
||||
int res = parse_command(buffer, count);
|
||||
|
||||
switch (res) {
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ static int blkdev_write_end(struct file *file, struct address_space *mapping,
|
|||
|
||||
/*
|
||||
* private llseek:
|
||||
* for a block special file file->f_path.dentry->d_inode->i_size is zero
|
||||
* for a block special file file_inode(file)->i_size is zero
|
||||
* so we compute the size by hand (just as in block_read/write above)
|
||||
*/
|
||||
static loff_t block_llseek(struct file *file, loff_t offset, int whence)
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len,
|
|||
|
||||
if (parent && (len < BTRFS_FID_SIZE_CONNECTABLE)) {
|
||||
*max_len = BTRFS_FID_SIZE_CONNECTABLE;
|
||||
return 255;
|
||||
return FILEID_INVALID;
|
||||
} else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) {
|
||||
*max_len = BTRFS_FID_SIZE_NON_CONNECTABLE;
|
||||
return 255;
|
||||
return FILEID_INVALID;
|
||||
}
|
||||
|
||||
len = BTRFS_FID_SIZE_NON_CONNECTABLE;
|
||||
|
|
|
|||
|
|
@ -1225,7 +1225,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file,
|
|||
struct extent_state *cached_state = NULL;
|
||||
int i;
|
||||
unsigned long index = pos >> PAGE_CACHE_SHIFT;
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
gfp_t mask = btrfs_alloc_write_mask(inode->i_mapping);
|
||||
int err = 0;
|
||||
int faili = 0;
|
||||
|
|
@ -1312,7 +1312,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
|
|||
struct iov_iter *i,
|
||||
loff_t pos)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct page **pages = NULL;
|
||||
unsigned long first_index;
|
||||
|
|
@ -1500,7 +1500,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
|
|||
unsigned long nr_segs, loff_t pos)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
loff_t *ppos = &iocb->ki_pos;
|
||||
u64 start_pos;
|
||||
|
|
@ -2102,7 +2102,7 @@ out:
|
|||
static long btrfs_fallocate(struct file *file, int mode,
|
||||
loff_t offset, loff_t len)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct extent_state *cached_state = NULL;
|
||||
u64 cur_offset;
|
||||
u64 last_byte;
|
||||
|
|
|
|||
|
|
@ -4391,7 +4391,7 @@ unsigned char btrfs_filetype_table[] = {
|
|||
static int btrfs_real_readdir(struct file *filp, void *dirent,
|
||||
filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_item *item;
|
||||
struct btrfs_dir_item *di;
|
||||
|
|
@ -6791,7 +6791,7 @@ static void btrfs_invalidatepage(struct page *page, unsigned long offset)
|
|||
int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||
{
|
||||
struct page *page = vmf->page;
|
||||
struct inode *inode = fdentry(vma->vm_file)->d_inode;
|
||||
struct inode *inode = file_inode(vma->vm_file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
|
||||
struct btrfs_ordered_extent *ordered;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ void btrfs_inherit_iflags(struct inode *inode, struct inode *dir)
|
|||
|
||||
static int btrfs_ioctl_getflags(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_inode *ip = BTRFS_I(file->f_path.dentry->d_inode);
|
||||
struct btrfs_inode *ip = BTRFS_I(file_inode(file));
|
||||
unsigned int flags = btrfs_flags_to_ioctl(ip->flags);
|
||||
|
||||
if (copy_to_user(arg, &flags, sizeof(flags)))
|
||||
|
|
@ -177,7 +177,7 @@ static int check_flags(unsigned int flags)
|
|||
|
||||
static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_inode *ip = BTRFS_I(inode);
|
||||
struct btrfs_root *root = ip->root;
|
||||
struct btrfs_trans_handle *trans;
|
||||
|
|
@ -310,7 +310,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
|
|||
|
||||
static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
|
||||
return put_user(inode->i_generation, arg);
|
||||
}
|
||||
|
|
@ -1320,7 +1320,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
|
|||
u64 new_size;
|
||||
u64 old_size;
|
||||
u64 devid = 1;
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_ioctl_vol_args *vol_args;
|
||||
struct btrfs_trans_handle *trans;
|
||||
struct btrfs_device *device = NULL;
|
||||
|
|
@ -1489,8 +1489,8 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
|
|||
goto out_drop_write;
|
||||
}
|
||||
|
||||
src_inode = src.file->f_path.dentry->d_inode;
|
||||
if (src_inode->i_sb != file->f_path.dentry->d_inode->i_sb) {
|
||||
src_inode = file_inode(src.file);
|
||||
if (src_inode->i_sb != file_inode(file)->i_sb) {
|
||||
printk(KERN_INFO "btrfs: Snapshot src from "
|
||||
"another FS\n");
|
||||
ret = -EINVAL;
|
||||
|
|
@ -1582,7 +1582,7 @@ out:
|
|||
static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
|
||||
void __user *arg)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
int ret = 0;
|
||||
u64 flags = 0;
|
||||
|
|
@ -1604,7 +1604,7 @@ static noinline int btrfs_ioctl_subvol_getflags(struct file *file,
|
|||
static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
|
||||
void __user *arg)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_trans_handle *trans;
|
||||
u64 root_flags;
|
||||
|
|
@ -1898,7 +1898,7 @@ static noinline int btrfs_ioctl_tree_search(struct file *file,
|
|||
if (IS_ERR(args))
|
||||
return PTR_ERR(args);
|
||||
|
||||
inode = fdentry(file)->d_inode;
|
||||
inode = file_inode(file);
|
||||
ret = search_ioctl(inode, args);
|
||||
if (ret == 0 && copy_to_user(argp, args, sizeof(*args)))
|
||||
ret = -EFAULT;
|
||||
|
|
@ -2008,7 +2008,7 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file,
|
|||
if (IS_ERR(args))
|
||||
return PTR_ERR(args);
|
||||
|
||||
inode = fdentry(file)->d_inode;
|
||||
inode = file_inode(file);
|
||||
|
||||
if (args->treeid == 0)
|
||||
args->treeid = BTRFS_I(inode)->root->root_key.objectid;
|
||||
|
|
@ -2184,7 +2184,7 @@ out:
|
|||
|
||||
static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_ioctl_defrag_range_args *range;
|
||||
int ret;
|
||||
|
|
@ -2244,7 +2244,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
|
|||
/* the rest are all set to zero by kzalloc */
|
||||
range->len = (u64)-1;
|
||||
}
|
||||
ret = btrfs_defrag_file(fdentry(file)->d_inode, file,
|
||||
ret = btrfs_defrag_file(file_inode(file), file,
|
||||
range, 0, 0);
|
||||
if (ret > 0)
|
||||
ret = 0;
|
||||
|
|
@ -2292,7 +2292,7 @@ out:
|
|||
|
||||
static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_ioctl_vol_args *vol_args;
|
||||
int ret;
|
||||
|
||||
|
|
@ -2415,7 +2415,7 @@ out:
|
|||
static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
|
||||
u64 off, u64 olen, u64 destoff)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct fd src_file;
|
||||
struct inode *src;
|
||||
|
|
@ -2461,7 +2461,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
|
|||
if (src_file.file->f_path.mnt != file->f_path.mnt)
|
||||
goto out_fput;
|
||||
|
||||
src = src_file.file->f_dentry->d_inode;
|
||||
src = file_inode(src_file.file);
|
||||
|
||||
ret = -EINVAL;
|
||||
if (src == inode)
|
||||
|
|
@ -2823,7 +2823,7 @@ static long btrfs_ioctl_clone_range(struct file *file, void __user *argp)
|
|||
*/
|
||||
static long btrfs_ioctl_trans_start(struct file *file)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_trans_handle *trans;
|
||||
int ret;
|
||||
|
|
@ -2863,7 +2863,7 @@ out:
|
|||
|
||||
static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_root *new_root;
|
||||
struct btrfs_dir_item *di;
|
||||
|
|
@ -3087,7 +3087,7 @@ out:
|
|||
*/
|
||||
long btrfs_ioctl_trans_end(struct file *file)
|
||||
{
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_trans_handle *trans;
|
||||
|
||||
|
|
@ -3149,7 +3149,7 @@ static noinline long btrfs_ioctl_wait_sync(struct btrfs_root *root,
|
|||
|
||||
static long btrfs_ioctl_scrub(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_ioctl_scrub_args *sa;
|
||||
int ret;
|
||||
|
||||
|
|
@ -3440,7 +3440,7 @@ void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock,
|
|||
|
||||
static long btrfs_ioctl_balance(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
struct btrfs_ioctl_balance_args *bargs;
|
||||
struct btrfs_balance_control *bctl;
|
||||
|
|
@ -3630,7 +3630,7 @@ out:
|
|||
|
||||
static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_ioctl_quota_ctl_args *sa;
|
||||
struct btrfs_trans_handle *trans = NULL;
|
||||
int ret;
|
||||
|
|
@ -3689,7 +3689,7 @@ drop_write:
|
|||
|
||||
static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_ioctl_qgroup_assign_args *sa;
|
||||
struct btrfs_trans_handle *trans;
|
||||
int ret;
|
||||
|
|
@ -3736,7 +3736,7 @@ drop_write:
|
|||
|
||||
static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_ioctl_qgroup_create_args *sa;
|
||||
struct btrfs_trans_handle *trans;
|
||||
int ret;
|
||||
|
|
@ -3787,7 +3787,7 @@ drop_write:
|
|||
|
||||
static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
struct btrfs_ioctl_qgroup_limit_args *sa;
|
||||
struct btrfs_trans_handle *trans;
|
||||
int ret;
|
||||
|
|
@ -3837,7 +3837,7 @@ static long btrfs_ioctl_set_received_subvol(struct file *file,
|
|||
void __user *arg)
|
||||
{
|
||||
struct btrfs_ioctl_received_subvol_args *sa = NULL;
|
||||
struct inode *inode = fdentry(file)->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_root_item *root_item = &root->root_item;
|
||||
struct btrfs_trans_handle *trans;
|
||||
|
|
@ -3917,7 +3917,7 @@ out:
|
|||
long btrfs_ioctl(struct file *file, unsigned int
|
||||
cmd, unsigned long arg)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
|
||||
struct btrfs_root *root = BTRFS_I(file_inode(file))->root;
|
||||
void __user *argp = (void __user *)arg;
|
||||
|
||||
switch (cmd) {
|
||||
|
|
|
|||
|
|
@ -4544,7 +4544,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
|
|||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
send_root = BTRFS_I(fdentry(mnt_file)->d_inode)->root;
|
||||
send_root = BTRFS_I(file_inode(mnt_file))->root;
|
||||
fs_info = send_root->fs_info;
|
||||
|
||||
arg = memdup_user(arg_, sizeof(*arg));
|
||||
|
|
|
|||
|
|
@ -2332,7 +2332,7 @@ int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
|
|||
get_block_t get_block)
|
||||
{
|
||||
struct page *page = vmf->page;
|
||||
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(vma->vm_file);
|
||||
unsigned long end;
|
||||
loff_t size;
|
||||
int ret;
|
||||
|
|
@ -2371,7 +2371,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
|
|||
get_block_t get_block)
|
||||
{
|
||||
int ret;
|
||||
struct super_block *sb = vma->vm_file->f_path.dentry->d_inode->i_sb;
|
||||
struct super_block *sb = file_inode(vma->vm_file)->i_sb;
|
||||
|
||||
sb_start_pagefault(sb);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ static int ceph_releasepage(struct page *page, gfp_t g)
|
|||
*/
|
||||
static int readpage_nounlock(struct file *filp, struct page *page)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_osd_client *osdc =
|
||||
&ceph_inode_to_client(inode)->client->osdc;
|
||||
|
|
@ -370,7 +370,7 @@ out:
|
|||
static int ceph_readpages(struct file *file, struct address_space *mapping,
|
||||
struct list_head *page_list, unsigned nr_pages)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
|
||||
int rc = 0;
|
||||
int max = 0;
|
||||
|
|
@ -977,7 +977,7 @@ static int ceph_update_writeable_page(struct file *file,
|
|||
loff_t pos, unsigned len,
|
||||
struct page *page)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
|
||||
loff_t page_off = pos & PAGE_CACHE_MASK;
|
||||
|
|
@ -1086,7 +1086,7 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
|
|||
loff_t pos, unsigned len, unsigned flags,
|
||||
struct page **pagep, void **fsdata)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_file_info *fi = file->private_data;
|
||||
struct page *page;
|
||||
|
|
@ -1144,7 +1144,7 @@ static int ceph_write_end(struct file *file, struct address_space *mapping,
|
|||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct page *page, void *fsdata)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
|
||||
struct ceph_mds_client *mdsc = fsc->mdsc;
|
||||
|
|
@ -1228,7 +1228,7 @@ const struct address_space_operations ceph_aops = {
|
|||
*/
|
||||
static int ceph_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||
{
|
||||
struct inode *inode = vma->vm_file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(vma->vm_file);
|
||||
struct page *page = vmf->page;
|
||||
struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
|
||||
loff_t off = page_offset(page);
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ static int note_last_dentry(struct ceph_file_info *fi, const char *name,
|
|||
static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct ceph_file_info *fi = filp->private_data;
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
|
||||
struct ceph_mds_client *mdsc = fsc->mdsc;
|
||||
|
|
@ -1138,7 +1138,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
|
|||
loff_t *ppos)
|
||||
{
|
||||
struct ceph_file_info *cf = file->private_data;
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
int left;
|
||||
const int bufsize = 1024;
|
||||
|
|
@ -1188,7 +1188,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
|
|||
static int ceph_dir_fsync(struct file *file, loff_t start, loff_t end,
|
||||
int datasync)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct list_head *head = &ci->i_unsafe_dirops;
|
||||
struct ceph_mds_request *req;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
|
|||
if (parent_inode) {
|
||||
/* nfsd wants connectable */
|
||||
*max_len = connected_handle_length;
|
||||
type = 255;
|
||||
type = FILEID_INVALID;
|
||||
} else {
|
||||
dout("encode_fh %p\n", dentry);
|
||||
fh->ino = ceph_ino(inode);
|
||||
|
|
@ -90,7 +90,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
|
|||
}
|
||||
} else {
|
||||
*max_len = handle_length;
|
||||
type = 255;
|
||||
type = FILEID_INVALID;
|
||||
}
|
||||
if (dentry)
|
||||
dput(dentry);
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ more:
|
|||
static ssize_t ceph_sync_read(struct file *file, char __user *data,
|
||||
unsigned len, loff_t *poff, int *checkeof)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct page **pages;
|
||||
u64 off = *poff;
|
||||
int num_pages, ret;
|
||||
|
|
@ -466,7 +466,7 @@ static void sync_write_commit(struct ceph_osd_request *req,
|
|||
static ssize_t ceph_sync_write(struct file *file, const char __user *data,
|
||||
size_t left, loff_t *offset)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
|
||||
struct ceph_osd_request *req;
|
||||
|
|
@ -483,7 +483,7 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
|
|||
int ret;
|
||||
struct timespec mtime = CURRENT_TIME;
|
||||
|
||||
if (ceph_snap(file->f_dentry->d_inode) != CEPH_NOSNAP)
|
||||
if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
|
||||
return -EROFS;
|
||||
|
||||
dout("sync_write on file %p %lld~%u %s\n", file, *offset,
|
||||
|
|
@ -637,7 +637,7 @@ static ssize_t ceph_aio_read(struct kiocb *iocb, const struct iovec *iov,
|
|||
struct ceph_file_info *fi = filp->private_data;
|
||||
loff_t *ppos = &iocb->ki_pos;
|
||||
size_t len = iov->iov_len;
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
void __user *base = iov->iov_base;
|
||||
ssize_t ret;
|
||||
|
|
@ -707,7 +707,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct ceph_file_info *fi = file->private_data;
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_osd_client *osdc =
|
||||
&ceph_sb_to_client(inode->i_sb)->client->osdc;
|
||||
|
|
|
|||
|
|
@ -1131,8 +1131,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req,
|
|||
req->r_request_started);
|
||||
dout(" final dn %p\n", dn);
|
||||
i++;
|
||||
} else if (req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
|
||||
req->r_op == CEPH_MDS_OP_MKSNAP) {
|
||||
} else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
|
||||
req->r_op == CEPH_MDS_OP_MKSNAP) && !req->r_aborted) {
|
||||
struct dentry *dn = req->r_dentry;
|
||||
|
||||
/* fill out a snapdir LOOKUPSNAP dentry */
|
||||
|
|
@ -1196,6 +1196,39 @@ done:
|
|||
/*
|
||||
* Prepopulate our cache with readdir results, leases, etc.
|
||||
*/
|
||||
static int readdir_prepopulate_inodes_only(struct ceph_mds_request *req,
|
||||
struct ceph_mds_session *session)
|
||||
{
|
||||
struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info;
|
||||
int i, err = 0;
|
||||
|
||||
for (i = 0; i < rinfo->dir_nr; i++) {
|
||||
struct ceph_vino vino;
|
||||
struct inode *in;
|
||||
int rc;
|
||||
|
||||
vino.ino = le64_to_cpu(rinfo->dir_in[i].in->ino);
|
||||
vino.snap = le64_to_cpu(rinfo->dir_in[i].in->snapid);
|
||||
|
||||
in = ceph_get_inode(req->r_dentry->d_sb, vino);
|
||||
if (IS_ERR(in)) {
|
||||
err = PTR_ERR(in);
|
||||
dout("new_inode badness got %d\n", err);
|
||||
continue;
|
||||
}
|
||||
rc = fill_inode(in, &rinfo->dir_in[i], NULL, session,
|
||||
req->r_request_started, -1,
|
||||
&req->r_caps_reservation);
|
||||
if (rc < 0) {
|
||||
pr_err("fill_inode badness on %p got %d\n", in, rc);
|
||||
err = rc;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int ceph_readdir_prepopulate(struct ceph_mds_request *req,
|
||||
struct ceph_mds_session *session)
|
||||
{
|
||||
|
|
@ -1210,6 +1243,9 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
|
|||
u64 frag = le32_to_cpu(rhead->args.readdir.frag);
|
||||
struct ceph_dentry_info *di;
|
||||
|
||||
if (req->r_aborted)
|
||||
return readdir_prepopulate_inodes_only(req, session);
|
||||
|
||||
if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) {
|
||||
snapdir = ceph_get_snapdir(parent->d_inode);
|
||||
parent = d_find_alias(snapdir);
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
*/
|
||||
static long ceph_ioctl_get_layout(struct file *file, void __user *arg)
|
||||
{
|
||||
struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode);
|
||||
struct ceph_inode_info *ci = ceph_inode(file_inode(file));
|
||||
struct ceph_ioctl_layout l;
|
||||
int err;
|
||||
|
||||
err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
|
||||
err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT);
|
||||
if (!err) {
|
||||
l.stripe_unit = ceph_file_layout_su(ci->i_layout);
|
||||
l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
|
||||
|
|
@ -63,12 +63,12 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
|
|||
|
||||
static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct inode *parent_inode;
|
||||
struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
|
||||
struct ceph_mds_request *req;
|
||||
struct ceph_ioctl_layout l;
|
||||
struct ceph_inode_info *ci = ceph_inode(file->f_dentry->d_inode);
|
||||
struct ceph_inode_info *ci = ceph_inode(file_inode(file));
|
||||
struct ceph_ioctl_layout nl;
|
||||
int err;
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
|
|||
return -EFAULT;
|
||||
|
||||
/* validate changed params against current layout */
|
||||
err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
|
||||
err = ceph_do_getattr(file_inode(file), CEPH_STAT_CAP_LAYOUT);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
|
|||
*/
|
||||
static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_mds_request *req;
|
||||
struct ceph_ioctl_layout l;
|
||||
int err;
|
||||
|
|
@ -179,7 +179,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
|
|||
static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
|
||||
{
|
||||
struct ceph_ioctl_dataloc dl;
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
struct ceph_osd_client *osdc =
|
||||
&ceph_sb_to_client(inode->i_sb)->client->osdc;
|
||||
|
|
@ -234,7 +234,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
|
|||
static long ceph_ioctl_lazyio(struct file *file)
|
||||
{
|
||||
struct ceph_file_info *fi = file->private_data;
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
|
||||
if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
static int ceph_lock_message(u8 lock_type, u16 operation, struct file *file,
|
||||
int cmd, u8 wait, struct file_lock *fl)
|
||||
{
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_mds_client *mdsc =
|
||||
ceph_sb_to_client(inode->i_sb)->mdsc;
|
||||
struct ceph_mds_request *req;
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ out_nls:
|
|||
static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos)
|
||||
{
|
||||
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
ssize_t written;
|
||||
int rc;
|
||||
|
||||
|
|
@ -707,7 +707,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int whence)
|
|||
*/
|
||||
if (whence != SEEK_SET && whence != SEEK_CUR) {
|
||||
int rc;
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
|
||||
/*
|
||||
* We need to be sure that all dirty pages are written and the
|
||||
|
|
@ -739,7 +739,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
|
|||
{
|
||||
/* note that this is called by vfs setlease with lock_flocks held
|
||||
to protect *lease from going away */
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct cifsFileInfo *cfile = file->private_data;
|
||||
|
||||
if (!(S_ISREG(inode->i_mode)))
|
||||
|
|
|
|||
|
|
@ -947,7 +947,7 @@ static int
|
|||
cifs_posix_lock_test(struct file *file, struct file_lock *flock)
|
||||
{
|
||||
int rc = 0;
|
||||
struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
|
||||
struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
|
||||
unsigned char saved_type = flock->fl_type;
|
||||
|
||||
if ((flock->fl_flags & FL_POSIX) == 0)
|
||||
|
|
@ -974,7 +974,7 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock)
|
|||
static int
|
||||
cifs_posix_lock_set(struct file *file, struct file_lock *flock)
|
||||
{
|
||||
struct cifsInodeInfo *cinode = CIFS_I(file->f_path.dentry->d_inode);
|
||||
struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
|
||||
int rc = 1;
|
||||
|
||||
if ((flock->fl_flags & FL_POSIX) == 0)
|
||||
|
|
@ -1548,7 +1548,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
|
|||
|
||||
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
|
||||
netfid = cfile->fid.netfid;
|
||||
cinode = CIFS_I(file->f_path.dentry->d_inode);
|
||||
cinode = CIFS_I(file_inode(file));
|
||||
|
||||
if (cap_unix(tcon->ses) &&
|
||||
(CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
|
||||
|
|
@ -2171,7 +2171,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
|
|||
struct cifs_tcon *tcon;
|
||||
struct TCP_Server_Info *server;
|
||||
struct cifsFileInfo *smbfile = file->private_data;
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
|
||||
|
||||
rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
|
||||
|
|
@ -2246,7 +2246,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
|
|||
*/
|
||||
int cifs_flush(struct file *file, fl_owner_t id)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
int rc = 0;
|
||||
|
||||
if (file->f_mode & FMODE_WRITE)
|
||||
|
|
@ -2480,7 +2480,7 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov,
|
|||
ssize_t written;
|
||||
struct inode *inode;
|
||||
|
||||
inode = iocb->ki_filp->f_path.dentry->d_inode;
|
||||
inode = file_inode(iocb->ki_filp);
|
||||
|
||||
/*
|
||||
* BB - optimize the way when signing is disabled. We can drop this
|
||||
|
|
@ -2543,7 +2543,7 @@ ssize_t
|
|||
cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos)
|
||||
{
|
||||
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
struct cifsInodeInfo *cinode = CIFS_I(inode);
|
||||
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
|
||||
struct cifsFileInfo *cfile = (struct cifsFileInfo *)
|
||||
|
|
@ -2915,7 +2915,7 @@ ssize_t
|
|||
cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos)
|
||||
{
|
||||
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
struct cifsInodeInfo *cinode = CIFS_I(inode);
|
||||
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
|
||||
struct cifsFileInfo *cfile = (struct cifsFileInfo *)
|
||||
|
|
@ -3063,7 +3063,7 @@ static struct vm_operations_struct cifs_file_vm_ops = {
|
|||
int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
|
||||
{
|
||||
int rc, xid;
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
|
||||
xid = get_xid();
|
||||
|
||||
|
|
@ -3356,7 +3356,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
|
|||
int rc;
|
||||
|
||||
/* Is the page cached? */
|
||||
rc = cifs_readpage_from_fscache(file->f_path.dentry->d_inode, page);
|
||||
rc = cifs_readpage_from_fscache(file_inode(file), page);
|
||||
if (rc == 0)
|
||||
goto read_complete;
|
||||
|
||||
|
|
@ -3371,8 +3371,8 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
|
|||
else
|
||||
cFYI(1, "Bytes read %d", rc);
|
||||
|
||||
file->f_path.dentry->d_inode->i_atime =
|
||||
current_fs_time(file->f_path.dentry->d_inode->i_sb);
|
||||
file_inode(file)->i_atime =
|
||||
current_fs_time(file_inode(file)->i_sb);
|
||||
|
||||
if (PAGE_CACHE_SIZE > rc)
|
||||
memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);
|
||||
|
|
@ -3381,7 +3381,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
|
|||
SetPageUptodate(page);
|
||||
|
||||
/* send this page to the cache */
|
||||
cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page);
|
||||
cifs_readpage_to_fscache(file_inode(file), page);
|
||||
|
||||
rc = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ cifs_get_file_info_unix(struct file *filp)
|
|||
unsigned int xid;
|
||||
FILE_UNIX_BASIC_INFO find_data;
|
||||
struct cifs_fattr fattr;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
|
||||
struct cifsFileInfo *cfile = filp->private_data;
|
||||
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
|
||||
|
|
@ -568,7 +568,7 @@ cifs_get_file_info(struct file *filp)
|
|||
unsigned int xid;
|
||||
FILE_ALL_INFO find_data;
|
||||
struct cifs_fattr fattr;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
|
||||
struct cifsFileInfo *cfile = filp->private_data;
|
||||
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
|
||||
|
|
@ -1688,7 +1688,7 @@ cifs_invalidate_mapping(struct inode *inode)
|
|||
int cifs_revalidate_file_attr(struct file *filp)
|
||||
{
|
||||
int rc = 0;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
|
||||
|
||||
if (!cifs_inode_needs_reval(inode))
|
||||
|
|
@ -1745,7 +1745,7 @@ out:
|
|||
int cifs_revalidate_file(struct file *filp)
|
||||
{
|
||||
int rc;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
|
||||
rc = cifs_revalidate_file_attr(filp);
|
||||
if (rc)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filep->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filep);
|
||||
int rc = -ENOTTY; /* strange error - but the precedent */
|
||||
unsigned int xid;
|
||||
struct cifs_sb_info *cifs_sb;
|
||||
|
|
|
|||
|
|
@ -82,12 +82,10 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
|
|||
|
||||
cFYI(1, "%s: for %s", __func__, name->name);
|
||||
|
||||
if (parent->d_op && parent->d_op->d_hash)
|
||||
parent->d_op->d_hash(parent, parent->d_inode, name);
|
||||
else
|
||||
name->hash = full_name_hash(name->name, name->len);
|
||||
dentry = d_hash_and_lookup(parent, name);
|
||||
if (unlikely(IS_ERR(dentry)))
|
||||
return;
|
||||
|
||||
dentry = d_lookup(parent, name);
|
||||
if (dentry) {
|
||||
int err;
|
||||
|
||||
|
|
@ -505,7 +503,7 @@ static int cifs_entry_is_dot(struct cifs_dirent *de, bool is_unicode)
|
|||
whether we can use the cached search results from the previous search */
|
||||
static int is_dir_changed(struct file *file)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
|
||||
|
||||
if (cifsInfo->time == 0)
|
||||
|
|
@ -778,7 +776,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
|
|||
switch ((int) file->f_pos) {
|
||||
case 0:
|
||||
if (filldir(direntry, ".", 1, file->f_pos,
|
||||
file->f_path.dentry->d_inode->i_ino, DT_DIR) < 0) {
|
||||
file_inode(file)->i_ino, DT_DIR) < 0) {
|
||||
cERROR(1, "Filldir for current dir failed");
|
||||
rc = -ENOMEM;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ static int coda_readdir(struct file *coda_file, void *buf, filldir_t filldir)
|
|||
* We can't use vfs_readdir because we have to keep the file
|
||||
* position in sync between the coda_file and the host_file.
|
||||
* and as such we need grab the inode mutex. */
|
||||
struct inode *host_inode = host_file->f_path.dentry->d_inode;
|
||||
struct inode *host_inode = file_inode(host_file);
|
||||
|
||||
mutex_lock(&host_inode->i_mutex);
|
||||
host_file->f_pos = coda_file->f_pos;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ coda_file_splice_read(struct file *coda_file, loff_t *ppos,
|
|||
static ssize_t
|
||||
coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
struct inode *host_inode, *coda_inode = coda_file->f_path.dentry->d_inode;
|
||||
struct inode *host_inode, *coda_inode = file_inode(coda_file);
|
||||
struct coda_file_info *cfi;
|
||||
struct file *host_file;
|
||||
ssize_t ret;
|
||||
|
|
@ -78,7 +78,7 @@ coda_file_write(struct file *coda_file, const char __user *buf, size_t count, lo
|
|||
if (!host_file->f_op || !host_file->f_op->write)
|
||||
return -EINVAL;
|
||||
|
||||
host_inode = host_file->f_path.dentry->d_inode;
|
||||
host_inode = file_inode(host_file);
|
||||
mutex_lock(&coda_inode->i_mutex);
|
||||
|
||||
ret = host_file->f_op->write(host_file, buf, count, ppos);
|
||||
|
|
@ -106,8 +106,8 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma)
|
|||
if (!host_file->f_op || !host_file->f_op->mmap)
|
||||
return -ENODEV;
|
||||
|
||||
coda_inode = coda_file->f_path.dentry->d_inode;
|
||||
host_inode = host_file->f_path.dentry->d_inode;
|
||||
coda_inode = file_inode(coda_file);
|
||||
host_inode = file_inode(host_file);
|
||||
|
||||
cii = ITOC(coda_inode);
|
||||
spin_lock(&cii->c_lock);
|
||||
|
|
@ -178,7 +178,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
|
|||
err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode),
|
||||
coda_flags, coda_file->f_cred->fsuid);
|
||||
|
||||
host_inode = cfi->cfi_container->f_path.dentry->d_inode;
|
||||
host_inode = file_inode(cfi->cfi_container);
|
||||
cii = ITOC(coda_inode);
|
||||
|
||||
/* did we mmap this file? */
|
||||
|
|
@ -202,7 +202,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
|
|||
int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync)
|
||||
{
|
||||
struct file *host_file;
|
||||
struct inode *coda_inode = coda_file->f_path.dentry->d_inode;
|
||||
struct inode *coda_inode = file_inode(coda_file);
|
||||
struct coda_file_info *cfi;
|
||||
int err;
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ static int get_device_index(struct coda_mount_data *data)
|
|||
f = fdget(data->fd);
|
||||
if (!f.file)
|
||||
goto Ebadf;
|
||||
inode = f.file->f_path.dentry->d_inode;
|
||||
inode = file_inode(f.file);
|
||||
if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) {
|
||||
fdput(f);
|
||||
goto Ebadf;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static long coda_pioctl(struct file *filp, unsigned int cmd,
|
|||
struct path path;
|
||||
int error;
|
||||
struct PioctlData data;
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct inode *target_inode = NULL;
|
||||
struct coda_inode_info *cnp;
|
||||
|
||||
|
|
|
|||
|
|
@ -1582,7 +1582,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
|
|||
case FIBMAP:
|
||||
case FIGETBSZ:
|
||||
case FIONREAD:
|
||||
if (S_ISREG(f.file->f_path.dentry->d_inode->i_mode))
|
||||
if (S_ISREG(file_inode(f.file)->i_mode))
|
||||
break;
|
||||
/*FALL THROUGH*/
|
||||
|
||||
|
|
|
|||
|
|
@ -1626,7 +1626,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
|
|||
if (offset >= 0)
|
||||
break;
|
||||
default:
|
||||
mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
|
||||
mutex_unlock(&file_inode(file)->i_mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (offset != file->f_pos) {
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ static void wait_for_dump_helpers(struct file *file)
|
|||
{
|
||||
struct pipe_inode_info *pipe;
|
||||
|
||||
pipe = file->f_path.dentry->d_inode->i_pipe;
|
||||
pipe = file_inode(file)->i_pipe;
|
||||
|
||||
pipe_lock(pipe);
|
||||
pipe->readers++;
|
||||
|
|
@ -600,7 +600,7 @@ void do_coredump(siginfo_t *siginfo)
|
|||
if (IS_ERR(cprm.file))
|
||||
goto fail_unlock;
|
||||
|
||||
inode = cprm.file->f_path.dentry->d_inode;
|
||||
inode = file_inode(cprm.file);
|
||||
if (inode->i_nlink > 1)
|
||||
goto close_fail;
|
||||
if (d_unhashed(cprm.file->f_path.dentry))
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|||
*/
|
||||
static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
char *buf;
|
||||
unsigned int offset;
|
||||
|
|
|
|||
80
fs/dcache.c
80
fs/dcache.c
|
|
@ -1358,6 +1358,7 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
|
|||
WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH |
|
||||
DCACHE_OP_COMPARE |
|
||||
DCACHE_OP_REVALIDATE |
|
||||
DCACHE_OP_WEAK_REVALIDATE |
|
||||
DCACHE_OP_DELETE ));
|
||||
dentry->d_op = op;
|
||||
if (!op)
|
||||
|
|
@ -1368,6 +1369,8 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op)
|
|||
dentry->d_flags |= DCACHE_OP_COMPARE;
|
||||
if (op->d_revalidate)
|
||||
dentry->d_flags |= DCACHE_OP_REVALIDATE;
|
||||
if (op->d_weak_revalidate)
|
||||
dentry->d_flags |= DCACHE_OP_WEAK_REVALIDATE;
|
||||
if (op->d_delete)
|
||||
dentry->d_flags |= DCACHE_OP_DELETE;
|
||||
if (op->d_prune)
|
||||
|
|
@ -1672,7 +1675,6 @@ EXPORT_SYMBOL(d_splice_alias);
|
|||
struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
|
||||
struct qstr *name)
|
||||
{
|
||||
int error;
|
||||
struct dentry *found;
|
||||
struct dentry *new;
|
||||
|
||||
|
|
@ -1681,10 +1683,12 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
|
|||
* if not go ahead and create it now.
|
||||
*/
|
||||
found = d_hash_and_lookup(dentry->d_parent, name);
|
||||
if (unlikely(IS_ERR(found)))
|
||||
goto err_out;
|
||||
if (!found) {
|
||||
new = d_alloc(dentry->d_parent, name);
|
||||
if (!new) {
|
||||
error = -ENOMEM;
|
||||
found = ERR_PTR(-ENOMEM);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
|
|
@ -1725,7 +1729,7 @@ struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode,
|
|||
|
||||
err_out:
|
||||
iput(inode);
|
||||
return ERR_PTR(error);
|
||||
return found;
|
||||
}
|
||||
EXPORT_SYMBOL(d_add_ci);
|
||||
|
||||
|
|
@ -1889,7 +1893,7 @@ seqretry:
|
|||
* dentry is returned. The caller must use dput to free the entry when it has
|
||||
* finished using it. %NULL is returned if the dentry does not exist.
|
||||
*/
|
||||
struct dentry *d_lookup(struct dentry *parent, struct qstr *name)
|
||||
struct dentry *d_lookup(const struct dentry *parent, const struct qstr *name)
|
||||
{
|
||||
struct dentry *dentry;
|
||||
unsigned seq;
|
||||
|
|
@ -1919,7 +1923,7 @@ EXPORT_SYMBOL(d_lookup);
|
|||
*
|
||||
* __d_lookup callers must be commented.
|
||||
*/
|
||||
struct dentry *__d_lookup(struct dentry *parent, struct qstr *name)
|
||||
struct dentry *__d_lookup(const struct dentry *parent, const struct qstr *name)
|
||||
{
|
||||
unsigned int len = name->len;
|
||||
unsigned int hash = name->hash;
|
||||
|
|
@ -1997,12 +2001,10 @@ next:
|
|||
* @dir: Directory to search in
|
||||
* @name: qstr of name we wish to find
|
||||
*
|
||||
* On hash failure or on lookup failure NULL is returned.
|
||||
* On lookup failure NULL is returned; on bad name - ERR_PTR(-error)
|
||||
*/
|
||||
struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name)
|
||||
{
|
||||
struct dentry *dentry = NULL;
|
||||
|
||||
/*
|
||||
* Check for a fs-specific hash function. Note that we must
|
||||
* calculate the standard hash first, as the d_op->d_hash()
|
||||
|
|
@ -2010,13 +2012,13 @@ struct dentry *d_hash_and_lookup(struct dentry *dir, struct qstr *name)
|
|||
*/
|
||||
name->hash = full_name_hash(name->name, name->len);
|
||||
if (dir->d_flags & DCACHE_OP_HASH) {
|
||||
if (dir->d_op->d_hash(dir, dir->d_inode, name) < 0)
|
||||
goto out;
|
||||
int err = dir->d_op->d_hash(dir, dir->d_inode, name);
|
||||
if (unlikely(err < 0))
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
dentry = d_lookup(dir, name);
|
||||
out:
|
||||
return dentry;
|
||||
return d_lookup(dir, name);
|
||||
}
|
||||
EXPORT_SYMBOL(d_hash_and_lookup);
|
||||
|
||||
/**
|
||||
* d_validate - verify dentry provided from insecure source (deprecated)
|
||||
|
|
@ -2394,7 +2396,7 @@ out_err:
|
|||
*/
|
||||
static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
|
||||
{
|
||||
struct dentry *dparent, *aparent;
|
||||
struct dentry *dparent;
|
||||
|
||||
dentry_lock_for_move(anon, dentry);
|
||||
|
||||
|
|
@ -2402,24 +2404,15 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
|
|||
write_seqcount_begin(&anon->d_seq);
|
||||
|
||||
dparent = dentry->d_parent;
|
||||
aparent = anon->d_parent;
|
||||
|
||||
switch_names(dentry, anon);
|
||||
swap(dentry->d_name.hash, anon->d_name.hash);
|
||||
|
||||
dentry->d_parent = (aparent == anon) ? dentry : aparent;
|
||||
list_del(&dentry->d_u.d_child);
|
||||
if (!IS_ROOT(dentry))
|
||||
list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs);
|
||||
else
|
||||
INIT_LIST_HEAD(&dentry->d_u.d_child);
|
||||
|
||||
anon->d_parent = (dparent == dentry) ? anon : dparent;
|
||||
dentry->d_parent = dentry;
|
||||
list_del_init(&dentry->d_u.d_child);
|
||||
anon->d_parent = dparent;
|
||||
list_del(&anon->d_u.d_child);
|
||||
if (!IS_ROOT(anon))
|
||||
list_add(&anon->d_u.d_child, &anon->d_parent->d_subdirs);
|
||||
else
|
||||
INIT_LIST_HEAD(&anon->d_u.d_child);
|
||||
list_add(&anon->d_u.d_child, &dparent->d_subdirs);
|
||||
|
||||
write_seqcount_end(&dentry->d_seq);
|
||||
write_seqcount_end(&anon->d_seq);
|
||||
|
|
@ -2722,37 +2715,6 @@ char *d_path(const struct path *path, char *buf, int buflen)
|
|||
}
|
||||
EXPORT_SYMBOL(d_path);
|
||||
|
||||
/**
|
||||
* d_path_with_unreachable - return the path of a dentry
|
||||
* @path: path to report
|
||||
* @buf: buffer to return value in
|
||||
* @buflen: buffer length
|
||||
*
|
||||
* The difference from d_path() is that this prepends "(unreachable)"
|
||||
* to paths which are unreachable from the current process' root.
|
||||
*/
|
||||
char *d_path_with_unreachable(const struct path *path, char *buf, int buflen)
|
||||
{
|
||||
char *res = buf + buflen;
|
||||
struct path root;
|
||||
int error;
|
||||
|
||||
if (path->dentry->d_op && path->dentry->d_op->d_dname)
|
||||
return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
|
||||
|
||||
get_fs_root(current->fs, &root);
|
||||
write_seqlock(&rename_lock);
|
||||
error = path_with_deleted(path, &root, &res, &buflen);
|
||||
if (error > 0)
|
||||
error = prepend_unreachable(&res, &buflen);
|
||||
write_sequnlock(&rename_lock);
|
||||
path_put(&root);
|
||||
if (error)
|
||||
res = ERR_PTR(error);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function for dentry_operations.d_dname() members
|
||||
*/
|
||||
|
|
@ -3035,7 +2997,7 @@ ino_t find_inode_number(struct dentry *dir, struct qstr *name)
|
|||
ino_t ino = 0;
|
||||
|
||||
dentry = d_hash_and_lookup(dir, name);
|
||||
if (dentry) {
|
||||
if (!IS_ERR_OR_NULL(dentry)) {
|
||||
if (dentry->d_inode)
|
||||
ino = dentry->d_inode->i_ino;
|
||||
dput(dentry);
|
||||
|
|
|
|||
|
|
@ -261,9 +261,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is
|
|||
dio->end_io(dio->iocb, offset, transferred,
|
||||
dio->private, ret, is_async);
|
||||
} else {
|
||||
inode_dio_done(dio->inode);
|
||||
if (is_async)
|
||||
aio_complete(dio->iocb, ret, 0);
|
||||
inode_dio_done(dio->inode);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ static ssize_t cluster_set(struct dlm_cluster *cl, unsigned int *cl_field,
|
|||
unsigned int x;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
x = simple_strtoul(buf, NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -509,6 +509,12 @@ ecryptfs_dentry_to_lower_mnt(struct dentry *dentry)
|
|||
return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt;
|
||||
}
|
||||
|
||||
static inline struct path *
|
||||
ecryptfs_dentry_to_lower_path(struct dentry *dentry)
|
||||
{
|
||||
return &((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path;
|
||||
}
|
||||
|
||||
static inline void
|
||||
ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir)
|
|||
|
||||
lower_file = ecryptfs_file_to_lower(file);
|
||||
lower_file->f_pos = file->f_pos;
|
||||
inode = file->f_path.dentry->d_inode;
|
||||
inode = file_inode(file);
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
buf.dirent = dirent;
|
||||
buf.dentry = file->f_path.dentry;
|
||||
|
|
@ -133,7 +133,7 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir)
|
|||
goto out;
|
||||
if (rc >= 0)
|
||||
fsstack_copy_attr_atime(inode,
|
||||
lower_file->f_path.dentry->d_inode);
|
||||
file_inode(lower_file));
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1027,8 +1027,7 @@ int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
|
|||
struct kstat lower_stat;
|
||||
int rc;
|
||||
|
||||
rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry),
|
||||
ecryptfs_dentry_to_lower(dentry), &lower_stat);
|
||||
rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat);
|
||||
if (!rc) {
|
||||
fsstack_copy_attr_all(dentry->d_inode,
|
||||
ecryptfs_inode_to_lower(dentry->d_inode));
|
||||
|
|
|
|||
|
|
@ -40,16 +40,12 @@ int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
|
|||
loff_t offset, size_t size)
|
||||
{
|
||||
struct file *lower_file;
|
||||
mm_segment_t fs_save;
|
||||
ssize_t rc;
|
||||
|
||||
lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file;
|
||||
if (!lower_file)
|
||||
return -EIO;
|
||||
fs_save = get_fs();
|
||||
set_fs(get_ds());
|
||||
rc = vfs_write(lower_file, data, size, &offset);
|
||||
set_fs(fs_save);
|
||||
rc = kernel_write(lower_file, data, size, offset);
|
||||
mark_inode_dirty_sync(ecryptfs_inode);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const struct inode_operations efs_dir_inode_operations = {
|
|||
};
|
||||
|
||||
static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct buffer_head *bh;
|
||||
|
||||
struct efs_dir *dirblock;
|
||||
|
|
|
|||
10
fs/exec.c
10
fs/exec.c
|
|
@ -123,7 +123,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
|
|||
goto out;
|
||||
|
||||
error = -EINVAL;
|
||||
if (!S_ISREG(file->f_path.dentry->d_inode->i_mode))
|
||||
if (!S_ISREG(file_inode(file)->i_mode))
|
||||
goto exit;
|
||||
|
||||
error = -EACCES;
|
||||
|
|
@ -355,7 +355,7 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len)
|
|||
* flags, permissions, and offset, so we use temporary values. We'll update
|
||||
* them later in setup_arg_pages().
|
||||
*/
|
||||
int bprm_mm_init(struct linux_binprm *bprm)
|
||||
static int bprm_mm_init(struct linux_binprm *bprm)
|
||||
{
|
||||
int err;
|
||||
struct mm_struct *mm = NULL;
|
||||
|
|
@ -764,7 +764,7 @@ struct file *open_exec(const char *name)
|
|||
goto out;
|
||||
|
||||
err = -EACCES;
|
||||
if (!S_ISREG(file->f_path.dentry->d_inode->i_mode))
|
||||
if (!S_ISREG(file_inode(file)->i_mode))
|
||||
goto exit;
|
||||
|
||||
if (file->f_path.mnt->mnt_flags & MNT_NOEXEC)
|
||||
|
|
@ -1098,7 +1098,7 @@ EXPORT_SYMBOL(flush_old_exec);
|
|||
|
||||
void would_dump(struct linux_binprm *bprm, struct file *file)
|
||||
{
|
||||
if (inode_permission(file->f_path.dentry->d_inode, MAY_READ) < 0)
|
||||
if (inode_permission(file_inode(file), MAY_READ) < 0)
|
||||
bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
|
||||
}
|
||||
EXPORT_SYMBOL(would_dump);
|
||||
|
|
@ -1270,7 +1270,7 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
|
|||
int prepare_binprm(struct linux_binprm *bprm)
|
||||
{
|
||||
umode_t mode;
|
||||
struct inode * inode = bprm->file->f_path.dentry->d_inode;
|
||||
struct inode * inode = file_inode(bprm->file);
|
||||
int retval;
|
||||
|
||||
mode = inode->i_mode;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ static int
|
|||
exofs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
loff_t pos = filp->f_pos;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
unsigned int offset = pos & ~PAGE_CACHE_MASK;
|
||||
unsigned long n = pos >> PAGE_CACHE_SHIFT;
|
||||
unsigned long npages = dir_pages(inode);
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ static int
|
|||
ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
|
||||
{
|
||||
loff_t pos = filp->f_pos;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
unsigned int offset = pos & ~PAGE_CACHE_MASK;
|
||||
unsigned long n = pos >> PAGE_CACHE_SHIFT;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct ext2_inode_info *ei = EXT2_I(inode);
|
||||
unsigned int flags;
|
||||
unsigned short rsv_window_size;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ static int ext3_readdir(struct file * filp,
|
|||
int i, stored;
|
||||
struct ext3_dir_entry_2 *de;
|
||||
int err;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
int ret = 0;
|
||||
int dir_has_error = 0;
|
||||
|
|
@ -114,7 +114,7 @@ static int ext3_readdir(struct file * filp,
|
|||
* We don't set the inode dirty flag since it's not
|
||||
* critical that it get flushed back to the disk.
|
||||
*/
|
||||
EXT3_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT3_INDEX_FL;
|
||||
EXT3_I(file_inode(filp))->i_flags &= ~EXT3_INDEX_FL;
|
||||
}
|
||||
stored = 0;
|
||||
offset = filp->f_pos & (sb->s_blocksize - 1);
|
||||
|
|
@ -457,7 +457,7 @@ static int call_filldir(struct file * filp, void * dirent,
|
|||
{
|
||||
struct dir_private_info *info = filp->private_data;
|
||||
loff_t curr_pos;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block * sb;
|
||||
int error;
|
||||
|
||||
|
|
@ -487,7 +487,7 @@ static int ext3_dx_readdir(struct file * filp,
|
|||
void * dirent, filldir_t filldir)
|
||||
{
|
||||
struct dir_private_info *info = filp->private_data;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct fname *fname;
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct ext3_inode_info *ei = EXT3_I(inode);
|
||||
unsigned int flags;
|
||||
unsigned short rsv_window_size;
|
||||
|
|
|
|||
|
|
@ -623,7 +623,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
|
|||
|
||||
dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
|
||||
start_minor_hash));
|
||||
dir = dir_file->f_path.dentry->d_inode;
|
||||
dir = file_inode(dir_file);
|
||||
if (!(EXT3_I(dir)->i_flags & EXT3_INDEX_FL)) {
|
||||
hinfo.hash_version = EXT3_SB(dir->i_sb)->s_def_hash_version;
|
||||
if (hinfo.hash_version <= DX_HASH_TEA)
|
||||
|
|
@ -637,7 +637,7 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
|
|||
}
|
||||
hinfo.hash = start_hash;
|
||||
hinfo.minor_hash = 0;
|
||||
frame = dx_probe(NULL, dir_file->f_path.dentry->d_inode, &hinfo, frames, &err);
|
||||
frame = dx_probe(NULL, file_inode(dir_file), &hinfo, frames, &err);
|
||||
if (!frame)
|
||||
return err;
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ static int ext4_readdir(struct file *filp,
|
|||
int i, stored;
|
||||
struct ext4_dir_entry_2 *de;
|
||||
int err;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
int ret = 0;
|
||||
int dir_has_error = 0;
|
||||
|
|
@ -133,7 +133,7 @@ static int ext4_readdir(struct file *filp,
|
|||
* We don't set the inode dirty flag since it's not
|
||||
* critical that it get flushed back to the disk.
|
||||
*/
|
||||
ext4_clear_inode_flag(filp->f_path.dentry->d_inode,
|
||||
ext4_clear_inode_flag(file_inode(filp),
|
||||
EXT4_INODE_INDEX);
|
||||
}
|
||||
stored = 0;
|
||||
|
|
@ -495,7 +495,7 @@ static int call_filldir(struct file *filp, void *dirent,
|
|||
{
|
||||
struct dir_private_info *info = filp->private_data;
|
||||
loff_t curr_pos;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb;
|
||||
int error;
|
||||
|
||||
|
|
@ -527,7 +527,7 @@ static int ext4_dx_readdir(struct file *filp,
|
|||
void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct dir_private_info *info = filp->private_data;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct fname *fname;
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -4309,7 +4309,7 @@ static void ext4_falloc_update_inode(struct inode *inode,
|
|||
*/
|
||||
long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
handle_t *handle;
|
||||
loff_t new_size;
|
||||
unsigned int max_blocks;
|
||||
|
|
@ -4571,7 +4571,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
|
|||
*/
|
||||
int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
ext4_lblk_t first_block, stop_block;
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static ssize_t
|
|||
ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos)
|
||||
{
|
||||
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
ssize_t ret;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1298,7 +1298,7 @@ int ext4_read_inline_dir(struct file *filp,
|
|||
int i, stored;
|
||||
struct ext4_dir_entry_2 *de;
|
||||
struct super_block *sb;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
int ret, inline_size = 0;
|
||||
struct ext4_iloc iloc;
|
||||
void *dir_buf = NULL;
|
||||
|
|
|
|||
|
|
@ -2948,7 +2948,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
|
|||
ssize_t size, void *private, int ret,
|
||||
bool is_async)
|
||||
{
|
||||
struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
ext4_io_end_t *io_end = iocb->private;
|
||||
|
||||
/* if not async direct IO or dio with 0 bytes write, just return */
|
||||
|
|
@ -3483,7 +3483,7 @@ int ext4_can_truncate(struct inode *inode)
|
|||
|
||||
int ext4_punch_hole(struct file *file, loff_t offset, loff_t length)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
if (!S_ISREG(inode->i_mode))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
|
|
@ -4855,7 +4855,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
|||
unsigned long len;
|
||||
int ret;
|
||||
struct file *file = vma->vm_file;
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
handle_t *handle;
|
||||
get_block_t *get_block;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct ext4_inode_info *ei = EXT4_I(inode);
|
||||
unsigned int flags;
|
||||
|
|
|
|||
|
|
@ -900,7 +900,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
|
|||
pgoff_t orig_page_offset, int data_offset_in_page,
|
||||
int block_len_in_page, int uninit, int *err)
|
||||
{
|
||||
struct inode *orig_inode = o_filp->f_dentry->d_inode;
|
||||
struct inode *orig_inode = file_inode(o_filp);
|
||||
struct page *pagep[2] = {NULL, NULL};
|
||||
handle_t *handle;
|
||||
ext4_lblk_t orig_blk_offset;
|
||||
|
|
@ -1279,8 +1279,8 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
|
|||
__u64 orig_start, __u64 donor_start, __u64 len,
|
||||
__u64 *moved_len)
|
||||
{
|
||||
struct inode *orig_inode = o_filp->f_dentry->d_inode;
|
||||
struct inode *donor_inode = d_filp->f_dentry->d_inode;
|
||||
struct inode *orig_inode = file_inode(o_filp);
|
||||
struct inode *donor_inode = file_inode(d_filp);
|
||||
struct ext4_ext_path *orig_path = NULL, *holecheck_path = NULL;
|
||||
struct ext4_extent *ext_prev, *ext_cur, *ext_dummy;
|
||||
ext4_lblk_t block_start = orig_start;
|
||||
|
|
|
|||
|
|
@ -964,7 +964,7 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
|
|||
|
||||
dxtrace(printk(KERN_DEBUG "In htree_fill_tree, start hash: %x:%x\n",
|
||||
start_hash, start_minor_hash));
|
||||
dir = dir_file->f_path.dentry->d_inode;
|
||||
dir = file_inode(dir_file);
|
||||
if (!(ext4_test_inode_flag(dir, EXT4_INODE_INDEX))) {
|
||||
hinfo.hash_version = EXT4_SB(dir->i_sb)->s_def_hash_version;
|
||||
if (hinfo.hash_version <= DX_HASH_TEA)
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ void ext4_error_file(struct file *file, const char *function,
|
|||
va_list args;
|
||||
struct va_format vaf;
|
||||
struct ext4_super_block *es;
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
char pathname[80], *path;
|
||||
|
||||
es = EXT4_SB(inode->i_sb)->s_es;
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ bool f2fs_empty_dir(struct inode *dir)
|
|||
static int f2fs_readdir(struct file *file, void *dirent, filldir_t filldir)
|
||||
{
|
||||
unsigned long pos = file->f_pos;
|
||||
struct inode *inode = file->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
unsigned long npages = dir_blocks(inode);
|
||||
unsigned char *types = NULL;
|
||||
unsigned int bit_pos = 0, start_bit_pos = 0;
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ out:
|
|||
|
||||
static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
return __fat_readdir(inode, filp, dirent, filldir, 0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -779,7 +779,7 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp,
|
|||
static long fat_dir_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg;
|
||||
int short_only, both;
|
||||
|
||||
|
|
@ -819,7 +819,7 @@ FAT_IOCTL_FILLDIR_FUNC(fat_compat_ioctl_filldir, compat_dirent)
|
|||
static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct compat_dirent __user *d1 = compat_ptr(arg);
|
||||
int short_only, both;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ static int fat_ioctl_get_attributes(struct inode *inode, u32 __user *user_attr)
|
|||
|
||||
static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
|
||||
int is_dir = S_ISDIR(inode->i_mode);
|
||||
u32 attr, oldattr;
|
||||
|
|
@ -116,7 +116,7 @@ out:
|
|||
|
||||
long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
u32 __user *user_attr = (u32 __user *)arg;
|
||||
|
||||
switch (cmd) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
static int setfl(int fd, struct file * filp, unsigned long arg)
|
||||
{
|
||||
struct inode * inode = filp->f_path.dentry->d_inode;
|
||||
struct inode * inode = file_inode(filp);
|
||||
int error = 0;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ int proc_nr_files(ctl_table *table, int write,
|
|||
#endif
|
||||
|
||||
/* Find an unused file structure and return a pointer to it.
|
||||
* Returns NULL, if there are no more free file structures or
|
||||
* we run out of memory.
|
||||
* Returns an error pointer if some error happend e.g. we over file
|
||||
* structures limit, run out of memory or operation is not permitted.
|
||||
*
|
||||
* Be very careful using this. You are responsible for
|
||||
* getting write access to any mount that you might assign
|
||||
|
|
@ -107,7 +107,8 @@ struct file *get_empty_filp(void)
|
|||
{
|
||||
const struct cred *cred = current_cred();
|
||||
static long old_max;
|
||||
struct file * f;
|
||||
struct file *f;
|
||||
int error;
|
||||
|
||||
/*
|
||||
* Privileged users can go above max_files
|
||||
|
|
@ -122,13 +123,16 @@ struct file *get_empty_filp(void)
|
|||
}
|
||||
|
||||
f = kmem_cache_zalloc(filp_cachep, GFP_KERNEL);
|
||||
if (f == NULL)
|
||||
goto fail;
|
||||
if (unlikely(!f))
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
percpu_counter_inc(&nr_files);
|
||||
f->f_cred = get_cred(cred);
|
||||
if (security_file_alloc(f))
|
||||
goto fail_sec;
|
||||
error = security_file_alloc(f);
|
||||
if (unlikely(error)) {
|
||||
file_free(f);
|
||||
return ERR_PTR(error);
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&f->f_u.fu_list);
|
||||
atomic_long_set(&f->f_count, 1);
|
||||
|
|
@ -144,12 +148,7 @@ over:
|
|||
pr_info("VFS: file-max limit %lu reached\n", get_max_files());
|
||||
old_max = get_nr_files();
|
||||
}
|
||||
goto fail;
|
||||
|
||||
fail_sec:
|
||||
file_free(f);
|
||||
fail:
|
||||
return NULL;
|
||||
return ERR_PTR(-ENFILE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -173,8 +172,8 @@ struct file *alloc_file(struct path *path, fmode_t mode,
|
|||
struct file *file;
|
||||
|
||||
file = get_empty_filp();
|
||||
if (!file)
|
||||
return NULL;
|
||||
if (IS_ERR(file))
|
||||
return file;
|
||||
|
||||
file->f_path = *path;
|
||||
file->f_mapping = path->dentry->d_inode->i_mapping;
|
||||
|
|
@ -447,7 +446,7 @@ void mark_files_ro(struct super_block *sb)
|
|||
|
||||
lg_global_lock(&files_lglock);
|
||||
do_file_list_for_each_entry(sb, f) {
|
||||
if (!S_ISREG(f->f_path.dentry->d_inode->i_mode))
|
||||
if (!S_ISREG(file_inode(f)->i_mode))
|
||||
continue;
|
||||
if (!file_count(f))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ vxfs_lookup(struct inode *dip, struct dentry *dp, unsigned int flags)
|
|||
static int
|
||||
vxfs_readdir(struct file *fp, void *retp, filldir_t filler)
|
||||
{
|
||||
struct inode *ip = fp->f_path.dentry->d_inode;
|
||||
struct inode *ip = file_inode(fp);
|
||||
struct super_block *sbp = ip->i_sb;
|
||||
u_long bsize = sbp->s_blocksize;
|
||||
u_long page, npages, block, pblocks, nblocks, offset;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ static struct fuse_conn *fuse_ctl_file_conn_get(struct file *file)
|
|||
{
|
||||
struct fuse_conn *fc;
|
||||
mutex_lock(&fuse_mutex);
|
||||
fc = file->f_path.dentry->d_inode->i_private;
|
||||
fc = file_inode(file)->i_private;
|
||||
if (fc)
|
||||
fc = fuse_conn_get(fc);
|
||||
mutex_unlock(&fuse_mutex);
|
||||
|
|
|
|||
|
|
@ -1325,7 +1325,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
|
|||
int plus, err;
|
||||
size_t nbytes;
|
||||
struct page *page;
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct fuse_conn *fc = get_fuse_conn(inode);
|
||||
struct fuse_req *req;
|
||||
u64 attr_version = 0;
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len,
|
|||
|
||||
if (*max_len < len) {
|
||||
*max_len = len;
|
||||
return 255;
|
||||
return FILEID_INVALID;
|
||||
}
|
||||
|
||||
nodeid = get_fuse_inode(inode)->nodeid;
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ static int gfs2_encode_fh(struct inode *inode, __u32 *p, int *len,
|
|||
|
||||
if (parent && (*len < GFS2_LARGE_FH_SIZE)) {
|
||||
*len = GFS2_LARGE_FH_SIZE;
|
||||
return 255;
|
||||
return FILEID_INVALID;
|
||||
} else if (*len < GFS2_SMALL_FH_SIZE) {
|
||||
*len = GFS2_SMALL_FH_SIZE;
|
||||
return 255;
|
||||
return FILEID_INVALID;
|
||||
}
|
||||
|
||||
fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ static const u32 gfs2_to_fsflags[32] = {
|
|||
|
||||
static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
struct gfs2_holder gh;
|
||||
int error;
|
||||
|
|
@ -217,7 +217,7 @@ void gfs2_set_inode_flags(struct inode *inode)
|
|||
*/
|
||||
static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
||||
struct buffer_head *bh;
|
||||
|
|
@ -293,7 +293,7 @@ out_drop_write:
|
|||
|
||||
static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
u32 fsflags, gfsflags;
|
||||
|
||||
if (get_user(fsflags, ptr))
|
||||
|
|
@ -336,7 +336,7 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|||
|
||||
static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size)
|
||||
{
|
||||
struct inode *inode = filep->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filep);
|
||||
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift;
|
||||
|
|
@ -386,7 +386,7 @@ static int gfs2_allocate_page_backing(struct page *page)
|
|||
static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||
{
|
||||
struct page *page = vmf->page;
|
||||
struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(vma->vm_file);
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
||||
unsigned long last_index;
|
||||
|
|
@ -673,8 +673,7 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
size_t writesize = iov_length(iov, nr_segs);
|
||||
struct dentry *dentry = file->f_dentry;
|
||||
struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
|
||||
struct gfs2_inode *ip = GFS2_I(file_inode(file));
|
||||
int ret;
|
||||
|
||||
ret = gfs2_rs_alloc(ip);
|
||||
|
|
@ -772,7 +771,7 @@ static void calc_max_reserv(struct gfs2_inode *ip, loff_t max, loff_t *len,
|
|||
static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
|
||||
loff_t len)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
|
||||
|
|
@ -938,7 +937,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
|
|||
{
|
||||
struct gfs2_file *fp = file->private_data;
|
||||
struct gfs2_holder *fl_gh = &fp->f_fl_gh;
|
||||
struct gfs2_inode *ip = GFS2_I(file->f_path.dentry->d_inode);
|
||||
struct gfs2_inode *ip = GFS2_I(file_inode(file));
|
||||
struct gfs2_glock *gl;
|
||||
unsigned int state;
|
||||
int flags;
|
||||
|
|
|
|||
|
|
@ -1257,7 +1257,7 @@ fail:
|
|||
|
||||
int gfs2_fitrim(struct file *filp, void __user *argp)
|
||||
{
|
||||
struct inode *inode = filp->f_dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
||||
struct request_queue *q = bdev_get_queue(sdp->sd_vfs->s_bdev);
|
||||
struct buffer_head *bh;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
|
|||
int n = simple_strtol(buf, NULL, 0);
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
switch (n) {
|
||||
case 0:
|
||||
|
|
@ -133,7 +133,7 @@ static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf)
|
|||
static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
|
||||
{
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (simple_strtol(buf, NULL, 0) != 1)
|
||||
return -EINVAL;
|
||||
|
|
@ -148,7 +148,7 @@ static ssize_t statfs_sync_store(struct gfs2_sbd *sdp, const char *buf,
|
|||
size_t len)
|
||||
{
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (simple_strtol(buf, NULL, 0) != 1)
|
||||
return -EINVAL;
|
||||
|
|
@ -161,7 +161,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf,
|
|||
size_t len)
|
||||
{
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (simple_strtol(buf, NULL, 0) != 1)
|
||||
return -EINVAL;
|
||||
|
|
@ -178,7 +178,7 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf,
|
|||
u32 id;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
id = simple_strtoul(buf, NULL, 0);
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf,
|
|||
u32 id;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
id = simple_strtoul(buf, NULL, 0);
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ static ssize_t demote_rq_store(struct gfs2_sbd *sdp, const char *buf, size_t len
|
|||
int rv;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
rv = sscanf(buf, "%u:%llu %15s", &gltype, &glnum,
|
||||
mode);
|
||||
|
|
@ -532,7 +532,7 @@ static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf,
|
|||
unsigned int x, y;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
if (sscanf(buf, "%u %u", &x, &y) != 2 || !y)
|
||||
return -EINVAL;
|
||||
|
|
@ -551,7 +551,7 @@ static ssize_t tune_set(struct gfs2_sbd *sdp, unsigned int *field,
|
|||
unsigned int x;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
return -EPERM;
|
||||
|
||||
x = simple_strtoul(buf, NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ done:
|
|||
*/
|
||||
static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
int len, err;
|
||||
char strbuf[HFS_MAX_NAMELEN];
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
|
|||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct address_space *mapping = file->f_mapping;
|
||||
struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
|
||||
struct inode *inode = file_inode(file)->i_mapping->host;
|
||||
ssize_t ret;
|
||||
|
||||
ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ fail:
|
|||
|
||||
static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
int len, err;
|
||||
char strbuf[HFSPLUS_MAX_STRLEN + 1];
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
|
|||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct address_space *mapping = file->f_mapping;
|
||||
struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host;
|
||||
struct inode *inode = file_inode(file)->i_mapping->host;
|
||||
ssize_t ret;
|
||||
|
||||
ret = blockdev_direct_IO(rw, iocb, inode, iov, offset, nr_segs,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static int hfsplus_ioctl_bless(struct file *file, int __user *user_flags)
|
|||
|
||||
static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
|
||||
unsigned int flags = 0;
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags)
|
|||
|
||||
static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
|
||||
unsigned int flags;
|
||||
int err = 0;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode)
|
|||
return list_entry(inode, struct hostfs_inode_info, vfs_inode);
|
||||
}
|
||||
|
||||
#define FILE_HOSTFS_I(file) HOSTFS_I((file)->f_path.dentry->d_inode)
|
||||
#define FILE_HOSTFS_I(file) HOSTFS_I(file_inode(file))
|
||||
|
||||
static int hostfs_d_delete(const struct dentry *dentry)
|
||||
{
|
||||
|
|
@ -861,14 +861,6 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
|
|||
}
|
||||
|
||||
static const struct inode_operations hostfs_iops = {
|
||||
.create = hostfs_create,
|
||||
.link = hostfs_link,
|
||||
.unlink = hostfs_unlink,
|
||||
.symlink = hostfs_symlink,
|
||||
.mkdir = hostfs_mkdir,
|
||||
.rmdir = hostfs_rmdir,
|
||||
.mknod = hostfs_mknod,
|
||||
.rename = hostfs_rename,
|
||||
.permission = hostfs_permission,
|
||||
.setattr = hostfs_setattr,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence)
|
|||
loff_t new_off = off + (whence == 1 ? filp->f_pos : 0);
|
||||
loff_t pos;
|
||||
struct quad_buffer_head qbh;
|
||||
struct inode *i = filp->f_path.dentry->d_inode;
|
||||
struct inode *i = file_inode(filp);
|
||||
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
|
||||
struct super_block *s = i->i_sb;
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ fail:
|
|||
|
||||
static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
|
||||
struct quad_buffer_head qbh;
|
||||
struct hpfs_dirent *de;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
|
|||
retval = do_sync_write(file, buf, count, ppos);
|
||||
if (retval > 0) {
|
||||
hpfs_lock(file->f_path.dentry->d_sb);
|
||||
hpfs_i(file->f_path.dentry->d_inode)->i_dirty = 1;
|
||||
hpfs_i(file_inode(file))->i_dirty = 1;
|
||||
hpfs_unlock(file->f_path.dentry->d_sb);
|
||||
}
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ static ssize_t read_proc(struct file *file, char __user *buf, ssize_t count,
|
|||
ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
|
||||
ssize_t n;
|
||||
|
||||
read = file->f_path.dentry->d_inode->i_fop->read;
|
||||
read = file_inode(file)->i_fop->read;
|
||||
|
||||
if (!is_user)
|
||||
set_fs(KERNEL_DS);
|
||||
|
|
@ -288,7 +288,7 @@ static ssize_t hppfs_write(struct file *file, const char __user *buf,
|
|||
struct file *proc_file = data->proc_file;
|
||||
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
|
||||
|
||||
write = proc_file->f_path.dentry->d_inode->i_fop->write;
|
||||
write = file_inode(proc_file)->i_fop->write;
|
||||
return (*write)(proc_file, buf, len, ppos);
|
||||
}
|
||||
|
||||
|
|
@ -513,7 +513,7 @@ static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
|
|||
loff_t (*llseek)(struct file *, loff_t, int);
|
||||
loff_t ret;
|
||||
|
||||
llseek = proc_file->f_path.dentry->d_inode->i_fop->llseek;
|
||||
llseek = file_inode(proc_file)->i_fop->llseek;
|
||||
if (llseek != NULL) {
|
||||
ret = (*llseek)(proc_file, off, where);
|
||||
if (ret < 0)
|
||||
|
|
@ -561,7 +561,7 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
|
|||
});
|
||||
int err;
|
||||
|
||||
readdir = proc_file->f_path.dentry->d_inode->i_fop->readdir;
|
||||
readdir = file_inode(proc_file)->i_fop->readdir;
|
||||
|
||||
proc_file->f_pos = file->f_pos;
|
||||
err = (*readdir)(proc_file, &dirent, hppfs_filldir);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ static void huge_pagevec_release(struct pagevec *pvec)
|
|||
|
||||
static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
loff_t len, vma_len;
|
||||
int ret;
|
||||
struct hstate *h = hstate_file(file);
|
||||
|
|
@ -918,16 +918,25 @@ static int get_hstate_idx(int page_size_log)
|
|||
return h - hstates;
|
||||
}
|
||||
|
||||
static char *hugetlb_dname(struct dentry *dentry, char *buffer, int buflen)
|
||||
{
|
||||
return dynamic_dname(dentry, buffer, buflen, "/%s (deleted)",
|
||||
dentry->d_name.name);
|
||||
}
|
||||
|
||||
static struct dentry_operations anon_ops = {
|
||||
.d_dname = hugetlb_dname
|
||||
};
|
||||
|
||||
struct file *hugetlb_file_setup(const char *name, unsigned long addr,
|
||||
size_t size, vm_flags_t acctflag,
|
||||
struct user_struct **user,
|
||||
int creat_flags, int page_size_log)
|
||||
{
|
||||
int error = -ENOMEM;
|
||||
struct file *file;
|
||||
struct file *file = ERR_PTR(-ENOMEM);
|
||||
struct inode *inode;
|
||||
struct path path;
|
||||
struct dentry *root;
|
||||
struct super_block *sb;
|
||||
struct qstr quick_string;
|
||||
struct hstate *hstate;
|
||||
unsigned long num_pages;
|
||||
|
|
@ -955,17 +964,18 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr,
|
|||
}
|
||||
}
|
||||
|
||||
root = hugetlbfs_vfsmount[hstate_idx]->mnt_root;
|
||||
sb = hugetlbfs_vfsmount[hstate_idx]->mnt_sb;
|
||||
quick_string.name = name;
|
||||
quick_string.len = strlen(quick_string.name);
|
||||
quick_string.hash = 0;
|
||||
path.dentry = d_alloc(root, &quick_string);
|
||||
path.dentry = d_alloc_pseudo(sb, &quick_string);
|
||||
if (!path.dentry)
|
||||
goto out_shm_unlock;
|
||||
|
||||
d_set_d_op(path.dentry, &anon_ops);
|
||||
path.mnt = mntget(hugetlbfs_vfsmount[hstate_idx]);
|
||||
error = -ENOSPC;
|
||||
inode = hugetlbfs_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0);
|
||||
file = ERR_PTR(-ENOSPC);
|
||||
inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0);
|
||||
if (!inode)
|
||||
goto out_dentry;
|
||||
|
||||
|
|
@ -973,7 +983,7 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr,
|
|||
size += addr & ~huge_page_mask(hstate);
|
||||
num_pages = ALIGN(size, huge_page_size(hstate)) >>
|
||||
huge_page_shift(hstate);
|
||||
error = -ENOMEM;
|
||||
file = ERR_PTR(-ENOMEM);
|
||||
if (hugetlb_reserve_pages(inode, 0, num_pages, NULL, acctflag))
|
||||
goto out_inode;
|
||||
|
||||
|
|
@ -981,10 +991,9 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr,
|
|||
inode->i_size = size;
|
||||
clear_nlink(inode);
|
||||
|
||||
error = -ENFILE;
|
||||
file = alloc_file(&path, FMODE_WRITE | FMODE_READ,
|
||||
&hugetlbfs_file_operations);
|
||||
if (!file)
|
||||
if (IS_ERR(file))
|
||||
goto out_dentry; /* inode is already attached */
|
||||
|
||||
return file;
|
||||
|
|
@ -998,7 +1007,7 @@ out_shm_unlock:
|
|||
user_shm_unlock(size, *user);
|
||||
*user = NULL;
|
||||
}
|
||||
return ERR_PTR(error);
|
||||
return file;
|
||||
}
|
||||
|
||||
static int __init init_hugetlbfs_fs(void)
|
||||
|
|
|
|||
|
|
@ -1655,7 +1655,7 @@ EXPORT_SYMBOL(file_remove_suid);
|
|||
|
||||
int file_update_time(struct file *file)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct timespec now;
|
||||
int sync_it = 0;
|
||||
int ret;
|
||||
|
|
|
|||
12
fs/ioctl.c
12
fs/ioctl.c
|
|
@ -175,7 +175,7 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg)
|
|||
struct fiemap fiemap;
|
||||
struct fiemap __user *ufiemap = (struct fiemap __user *) arg;
|
||||
struct fiemap_extent_info fieinfo = { 0, };
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
u64 len;
|
||||
int error;
|
||||
|
|
@ -424,7 +424,7 @@ EXPORT_SYMBOL(generic_block_fiemap);
|
|||
*/
|
||||
int ioctl_preallocate(struct file *filp, void __user *argp)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
struct space_resv sr;
|
||||
|
||||
if (copy_from_user(&sr, argp, sizeof(sr)))
|
||||
|
|
@ -449,7 +449,7 @@ int ioctl_preallocate(struct file *filp, void __user *argp)
|
|||
static int file_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
int __user *p = (int __user *)arg;
|
||||
|
||||
switch (cmd) {
|
||||
|
|
@ -512,7 +512,7 @@ static int ioctl_fioasync(unsigned int fd, struct file *filp,
|
|||
|
||||
static int ioctl_fsfreeze(struct file *filp)
|
||||
{
|
||||
struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
|
||||
struct super_block *sb = file_inode(filp)->i_sb;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
|
@ -527,7 +527,7 @@ static int ioctl_fsfreeze(struct file *filp)
|
|||
|
||||
static int ioctl_fsthaw(struct file *filp)
|
||||
{
|
||||
struct super_block *sb = filp->f_path.dentry->d_inode->i_sb;
|
||||
struct super_block *sb = file_inode(filp)->i_sb;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
|
@ -548,7 +548,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
|
|||
{
|
||||
int error = 0;
|
||||
int __user *argp = (int __user *)arg;
|
||||
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||
struct inode *inode = file_inode(filp);
|
||||
|
||||
switch (cmd) {
|
||||
case FIOCLEX:
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue