Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74d01958 authored by Al Viro's avatar Al Viro
Browse files

lustre: opened file can't have negative dentry



... and ll_md_close() gets inode already equal to file_inode(file),
along with ll_file_release()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c139f3ce
Loading
Loading
Loading
Loading
+21 −30
Original line number Diff line number Diff line
@@ -266,6 +266,10 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
{
	struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
	struct ll_inode_info *lli = ll_i2info(inode);
	int lockmode;
	__u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
	struct lustre_handle lockh;
	ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}};
	int rc = 0;

	/* clear group lock, if present */
@@ -292,12 +296,6 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,

	/* Let's see if we have good enough OPEN lock on the file and if
	   we can skip talking to MDS */
	if (file->f_dentry->d_inode) { /* Can this ever be false? */
		int lockmode;
		__u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
		struct lustre_handle lockh;
		struct inode *inode = file->f_dentry->d_inode;
		ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}};

	mutex_lock(&lli->lli_och_mutex);
	if (fd->fd_omode & FMODE_WRITE) {
@@ -316,15 +314,8 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
	mutex_unlock(&lli->lli_och_mutex);

	if (!md_lock_match(md_exp, flags, ll_inode2fid(inode),
				   LDLM_IBITS, &policy, lockmode,
				   &lockh)) {
			rc = ll_md_real_close(file->f_dentry->d_inode,
					      fd->fd_omode);
		}
	} else {
		CERROR("Releasing a file %p with negative dentry %p. Name %s",
		       file, file->f_dentry, file->f_dentry->d_name.name);
	}
			   LDLM_IBITS, &policy, lockmode, &lockh))
		rc = ll_md_real_close(inode, fd->fd_omode);

out:
	LUSTRE_FPRIVATE(file) = NULL;