提交 b4f840c1 编写于 作者: L Li Dongyang 提交者: Greg Kroah-Hartman

staging: lustre: mdt: fail FMODE_WRITE open if the client is read only

O_WRONLY/O_RDWR open on a file will get EROFS on a read only client,
but the rpc gets sent to the mdt anyway.
mdt will increase the mot_write_count of the mdt object, blocking
subsequent FMODE_EXEC open to the same file.

This patch makes sure we fail the FMODE_WRITE open with EROFS on the
client straight away without sending the rpc to mdt.
Signed-off-by: NLi Dongyang <dongyang.li@anu.edu.au>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7727
Reviewed-on: http://review.whamcloud.com/18242Reviewed-by: NIan Costello <icostello@ddn.com>
Reviewed-by: NNathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: NYang Sheng <yang.sheng@intel.com>
Reviewed-by: NOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: NJames Simmons <jsimmons@infradead.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 2ba88d4e
......@@ -572,6 +572,10 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
}
}
if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE &&
dentry->d_sb->s_flags & MS_RDONLY)
return ERR_PTR(-EROFS);
if (it->it_op & IT_CREAT)
opc = LUSTRE_OPC_CREATE;
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册