Unverified Commit bb4bf324 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!13448 bugfix of nfs

parents d606c904 9ee7a073
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1131,7 +1131,8 @@ int nfs_open(struct inode *inode, struct file *filp)
{
	struct nfs_open_context *ctx;

	ctx = alloc_nfs_open_context(file_dentry(filp), filp->f_mode, filp);
	ctx = alloc_nfs_open_context(file_dentry(filp),
				     flags_to_mode(filp->f_flags), filp);
	if (IS_ERR(ctx))
		return PTR_ERR(ctx);
	nfs_file_set_open_context(filp, ctx);
+4 −8
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ nfs4_file_open(struct inode *inode, struct file *filp)
	struct dentry *parent = NULL;
	struct inode *dir;
	unsigned openflags = filp->f_flags;
	fmode_t f_mode;
	struct iattr attr;
	int err;

@@ -51,17 +50,14 @@ nfs4_file_open(struct inode *inode, struct file *filp)
	if (err)
		return err;

	f_mode = filp->f_mode;
	if ((openflags & O_ACCMODE) == 3)
		f_mode |= flags_to_mode(openflags);

	/* We can't create new files here */
	openflags &= ~(O_CREAT|O_EXCL);

	parent = dget_parent(dentry);
	dir = d_inode(parent);

	ctx = alloc_nfs_open_context(file_dentry(filp), f_mode, filp);
	ctx = alloc_nfs_open_context(file_dentry(filp),
				     flags_to_mode(openflags), filp);
	err = PTR_ERR(ctx);
	if (IS_ERR(ctx))
		goto out;
@@ -367,8 +363,8 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,
	}
	filep->f_mode |= FMODE_READ;

	ctx = alloc_nfs_open_context(filep->f_path.dentry, filep->f_mode,
					filep);
	ctx = alloc_nfs_open_context(filep->f_path.dentry,
				     flags_to_mode(filep->f_flags), filep);
	if (IS_ERR(ctx)) {
		res = ERR_CAST(ctx);
		goto out_filep;
+5 −11
Original line number Diff line number Diff line
@@ -2621,8 +2621,7 @@ static int _nfs4_recover_proc_open(struct nfs4_opendata *data)
 */
static int nfs4_opendata_access(const struct cred *cred,
				struct nfs4_opendata *opendata,
				struct nfs4_state *state, fmode_t fmode,
				int openflags)
				struct nfs4_state *state, fmode_t fmode)
{
	struct nfs_access_entry cache;
	u32 mask, flags;
@@ -2633,11 +2632,7 @@ static int nfs4_opendata_access(const struct cred *cred,
		return 0;

	mask = 0;
	/*
	 * Use openflags to check for exec, because fmode won't
	 * always have FMODE_EXEC set when file open for exec.
	 */
	if (openflags & __FMODE_EXEC) {
	if (fmode & FMODE_EXEC) {
		/* ONLY check for exec rights */
		if (S_ISDIR(state->inode->i_mode))
			mask = NFS4_ACCESS_LOOKUP;
@@ -3027,7 +3022,7 @@ static unsigned nfs4_exclusive_attrset(struct nfs4_opendata *opendata,
}

static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
		int flags, struct nfs_open_context *ctx)
		struct nfs_open_context *ctx)
{
	struct nfs4_state_owner *sp = opendata->owner;
	struct nfs_server *server = sp->so_server;
@@ -3086,8 +3081,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
	/* Parse layoutget results before we check for access */
	pnfs_parse_lgopen(state->inode, opendata->lgp, ctx);

	ret = nfs4_opendata_access(sp->so_cred, opendata, state,
			acc_mode, flags);
	ret = nfs4_opendata_access(sp->so_cred, opendata, state, acc_mode);
	if (ret != 0)
		goto out;

@@ -3170,7 +3164,7 @@ static int _nfs4_do_open(struct inode *dir,
	if (d_really_is_positive(dentry))
		opendata->state = nfs4_get_open_state(d_inode(dentry), sp);

	status = _nfs4_open_and_get_state(opendata, flags, ctx);
	status = _nfs4_open_and_get_state(opendata, ctx);
	if (status != 0)
		goto err_free_label;
	state = ctx->state;