Skip to content

Commit

Permalink
Automatic merge of 'master' into merge (2021-03-17 14:13)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpe committed Mar 17, 2021
2 parents 0512161 + 1df2731 commit 86db1b2
Show file tree
Hide file tree
Showing 23 changed files with 114 additions and 142 deletions.
1 change: 0 additions & 1 deletion fs/afs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = {
.permission = afs_permission,
.getattr = afs_getattr,
.setattr = afs_setattr,
.listxattr = afs_listxattr,
};

const struct address_space_operations afs_dir_aops = {
Expand Down
1 change: 0 additions & 1 deletion fs/afs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = {
.getattr = afs_getattr,
.setattr = afs_setattr,
.permission = afs_permission,
.listxattr = afs_listxattr,
};

const struct address_space_operations afs_fs_aops = {
Expand Down
7 changes: 5 additions & 2 deletions fs/afs/fs_operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,13 @@ void afs_wait_for_operation(struct afs_operation *op)
if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) &&
op->ops->issue_yfs_rpc)
op->ops->issue_yfs_rpc(op);
else
else if (op->ops->issue_afs_rpc)
op->ops->issue_afs_rpc(op);
else
op->ac.error = -ENOTSUPP;

op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
if (op->call)
op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
}

switch (op->error) {
Expand Down
1 change: 0 additions & 1 deletion fs/afs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

static const struct inode_operations afs_symlink_inode_operations = {
.get_link = page_get_link,
.listxattr = afs_listxattr,
};

static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)
Expand Down
1 change: 0 additions & 1 deletion fs/afs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *);
* xattr.c
*/
extern const struct xattr_handler *afs_xattr_handlers[];
extern ssize_t afs_listxattr(struct dentry *, char *, size_t);

/*
* yfsclient.c
Expand Down
1 change: 0 additions & 1 deletion fs/afs/mntpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = {
.lookup = afs_mntpt_lookup,
.readlink = page_readlink,
.getattr = afs_getattr,
.listxattr = afs_listxattr,
};

const struct inode_operations afs_autocell_inode_operations = {
Expand Down
31 changes: 7 additions & 24 deletions fs/afs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,6 @@
#include <linux/xattr.h>
#include "internal.h"

static const char afs_xattr_list[] =
"afs.acl\0"
"afs.cell\0"
"afs.fid\0"
"afs.volume\0"
"afs.yfs.acl\0"
"afs.yfs.acl_inherited\0"
"afs.yfs.acl_num_cleaned\0"
"afs.yfs.vol_acl";

/*
* Retrieve a list of the supported xattrs.
*/
ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
{
if (size == 0)
return sizeof(afs_xattr_list);
if (size < sizeof(afs_xattr_list))
return -ERANGE;
memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
return sizeof(afs_xattr_list);
}

/*
* Deal with the result of a successful fetch ACL operation.
*/
Expand Down Expand Up @@ -231,6 +208,8 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
else
ret = -ERANGE;
}
} else if (ret == -ENOTSUPP) {
ret = -ENODATA;
}

error_yacl:
Expand All @@ -256,6 +235,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
{
struct afs_operation *op;
struct afs_vnode *vnode = AFS_FS_I(inode);
int ret;

if (flags == XATTR_CREATE ||
strcmp(name, "acl") != 0)
Expand All @@ -270,7 +250,10 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
return afs_put_operation(op);

op->ops = &yfs_store_opaque_acl2_operation;
return afs_do_sync_operation(op);
ret = afs_do_sync_operation(op);
if (ret == -ENOTSUPP)
ret = -ENODATA;
return ret;
}

static const struct xattr_handler afs_xattr_yfs_handler = {
Expand Down
26 changes: 16 additions & 10 deletions fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2229,19 +2229,21 @@ static int fuse_device_clone(struct fuse_conn *fc, struct file *new)
static long fuse_dev_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
int err = -ENOTTY;
int res;
int oldfd;
struct fuse_dev *fud = NULL;

if (cmd == FUSE_DEV_IOC_CLONE) {
int oldfd;
if (_IOC_TYPE(cmd) != FUSE_DEV_IOC_MAGIC)
return -ENOTTY;

err = -EFAULT;
if (!get_user(oldfd, (__u32 __user *) arg)) {
switch (_IOC_NR(cmd)) {
case _IOC_NR(FUSE_DEV_IOC_CLONE):
res = -EFAULT;
if (!get_user(oldfd, (__u32 __user *)arg)) {
struct file *old = fget(oldfd);

err = -EINVAL;
res = -EINVAL;
if (old) {
struct fuse_dev *fud = NULL;

/*
* Check against file->f_op because CUSE
* uses the same ioctl handler.
Expand All @@ -2252,14 +2254,18 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd,

if (fud) {
mutex_lock(&fuse_mutex);
err = fuse_device_clone(fud->fc, file);
res = fuse_device_clone(fud->fc, file);
mutex_unlock(&fuse_mutex);
}
fput(old);
}
}
break;
default:
res = -ENOTTY;
break;
}
return err;
return res;
}

const struct file_operations fuse_dev_operations = {
Expand Down
1 change: 1 addition & 0 deletions fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc)

static inline void fuse_make_bad(struct inode *inode)
{
remove_inode_hash(inode);
set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state);
}

Expand Down
9 changes: 8 additions & 1 deletion fs/fuse/virtio_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1324,8 +1324,15 @@ static int virtio_fs_fill_super(struct super_block *sb, struct fs_context *fsc)

/* virtiofs allocates and installs its own fuse devices */
ctx->fudptr = NULL;
if (ctx->dax)
if (ctx->dax) {
if (!fs->dax_dev) {
err = -EINVAL;
pr_err("virtio-fs: dax can't be enabled as filesystem"
" device does not support it.\n");
goto err_free_fuse_devs;
}
ctx->dax_dev = fs->dax_dev;
}
err = fuse_fill_super_common(sb, ctx);
if (err < 0)
goto err_free_fuse_devs;
Expand Down
3 changes: 0 additions & 3 deletions fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1808,9 +1808,6 @@ check_conflicting_open(struct file *filp, const long arg, int flags)

if (flags & FL_LAYOUT)
return 0;
if (flags & FL_DELEG)
/* We leave these checks to the caller. */
return 0;

if (arg == F_RDLCK)
return inode_is_open_for_write(inode) ? -EAGAIN : 0;
Expand Down
1 change: 1 addition & 0 deletions fs/nfsd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ config NFSD_V4
select NFSD_V3
select FS_POSIX_ACL
select SUNRPC_GSS
select CRYPTO
select CRYPTO_MD5
select CRYPTO_SHA256
select GRACE_PERIOD
Expand Down
2 changes: 2 additions & 0 deletions fs/nfsd/filecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,8 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags,
continue;
if (!nfsd_match_cred(nf->nf_cred, current_cred()))
continue;
if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
continue;
if (nfsd_file_get(nf) != NULL)
return nf;
}
Expand Down
1 change: 1 addition & 0 deletions fs/nfsd/nfs4callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,7 @@ static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
switch (task->tk_status) {
case -EIO:
case -ETIMEDOUT:
case -EACCES:
nfsd4_mark_cb_down(clp, task->tk_status);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion fs/nfsd/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ nfsd4_cleanup_inter_ssc(struct vfsmount *ss_mnt, struct nfsd_file *src,
struct nfsd_file *dst)
{
nfs42_ssc_close(src->nf_file);
/* 'src' is freed by nfsd4_do_async_copy */
fput(src->nf_file);
nfsd_file_put(dst);
mntput(ss_mnt);
}
Expand Down
55 changes: 15 additions & 40 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -4940,31 +4940,6 @@ static struct file_lock *nfs4_alloc_init_lease(struct nfs4_delegation *dp,
return fl;
}

static int nfsd4_check_conflicting_opens(struct nfs4_client *clp,
struct nfs4_file *fp)
{
struct nfs4_clnt_odstate *co;
struct file *f = fp->fi_deleg_file->nf_file;
struct inode *ino = locks_inode(f);
int writes = atomic_read(&ino->i_writecount);

if (fp->fi_fds[O_WRONLY])
writes--;
if (fp->fi_fds[O_RDWR])
writes--;
if (writes > 0)
return -EAGAIN;
spin_lock(&fp->fi_lock);
list_for_each_entry(co, &fp->fi_clnt_odstate, co_perfile) {
if (co->co_client != clp) {
spin_unlock(&fp->fi_lock);
return -EAGAIN;
}
}
spin_unlock(&fp->fi_lock);
return 0;
}

static struct nfs4_delegation *
nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate)
Expand All @@ -4984,12 +4959,9 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,

nf = find_readable_file(fp);
if (!nf) {
/*
* We probably could attempt another open and get a read
* delegation, but for now, don't bother until the
* client actually sends us one.
*/
return ERR_PTR(-EAGAIN);
/* We should always have a readable file here */
WARN_ON_ONCE(1);
return ERR_PTR(-EBADF);
}
spin_lock(&state_lock);
spin_lock(&fp->fi_lock);
Expand Down Expand Up @@ -5019,19 +4991,11 @@ nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh,
if (!fl)
goto out_clnt_odstate;

status = nfsd4_check_conflicting_opens(clp, fp);
if (status) {
locks_free_lock(fl);
goto out_clnt_odstate;
}
status = vfs_setlease(fp->fi_deleg_file->nf_file, fl->fl_type, &fl, NULL);
if (fl)
locks_free_lock(fl);
if (status)
goto out_clnt_odstate;
status = nfsd4_check_conflicting_opens(clp, fp);
if (status)
goto out_clnt_odstate;

spin_lock(&state_lock);
spin_lock(&fp->fi_lock);
Expand Down Expand Up @@ -5113,6 +5077,17 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open,
goto out_no_deleg;
if (!cb_up || !(oo->oo_flags & NFS4_OO_CONFIRMED))
goto out_no_deleg;
/*
* Also, if the file was opened for write or
* create, there's a good chance the client's
* about to write to it, resulting in an
* immediate recall (since we don't support
* write delegations):
*/
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
goto out_no_deleg;
if (open->op_create == NFS4_OPEN_CREATE)
goto out_no_deleg;
break;
default:
goto out_no_deleg;
Expand Down Expand Up @@ -5389,7 +5364,7 @@ nfs4_laundromat(struct nfsd_net *nn)
idr_for_each_entry(&nn->s2s_cp_stateids, cps_t, i) {
cps = container_of(cps_t, struct nfs4_cpntf_state, cp_stateid);
if (cps->cp_stateid.sc_type == NFS4_COPYNOTIFY_STID &&
cps->cpntf_time > cutoff)
cps->cpntf_time < cutoff)
_free_cpntf_state_locked(nn, cps);
}
spin_unlock(&nn->s2s_cp_lock);
Expand Down
1 change: 0 additions & 1 deletion include/linux/sunrpc/svc_rdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ struct svcxprt_rdma {

wait_queue_head_t sc_send_wait; /* SQ exhaustion waitlist */
unsigned long sc_flags;
u32 sc_pending_recvs;
struct list_head sc_read_complete_q;
struct work_struct sc_work;

Expand Down
3 changes: 2 additions & 1 deletion include/uapi/linux/fuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,8 @@ struct fuse_notify_retrieve_in {
};

/* Device ioctls: */
#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t)
#define FUSE_DEV_IOC_MAGIC 229
#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)

struct fuse_lseek_in {
uint64_t fh;
Expand Down
11 changes: 7 additions & 4 deletions net/sunrpc/auth_gss/svcauth_gss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1825,11 +1825,14 @@ static int
svcauth_gss_release(struct svc_rqst *rqstp)
{
struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data;
struct rpc_gss_wire_cred *gc = &gsd->clcred;
struct rpc_gss_wire_cred *gc;
struct xdr_buf *resbuf = &rqstp->rq_res;
int stat = -EINVAL;
struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id);

if (!gsd)
goto out;
gc = &gsd->clcred;
if (gc->gc_proc != RPC_GSS_PROC_DATA)
goto out;
/* Release can be called twice, but we only wrap once. */
Expand Down Expand Up @@ -1870,10 +1873,10 @@ svcauth_gss_release(struct svc_rqst *rqstp)
if (rqstp->rq_cred.cr_group_info)
put_group_info(rqstp->rq_cred.cr_group_info);
rqstp->rq_cred.cr_group_info = NULL;
if (gsd->rsci)
if (gsd && gsd->rsci) {
cache_put(&gsd->rsci->h, sn->rsc_cache);
gsd->rsci = NULL;

gsd->rsci = NULL;
}
return stat;
}

Expand Down
Loading

0 comments on commit 86db1b2

Please sign in to comment.