Whamcloud - gitweb
LU-7727 mdt: fail FMODE_WRITE open if the client is read only 42/18242/2
authorLi Dongyang <dongyang.li@anu.edu.au>
Mon, 1 Feb 2016 04:31:03 +0000 (15:31 +1100)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 14 Mar 2016 02:41:41 +0000 (02:41 +0000)
commiteb37bd1269b0c4ac182398ea7017a758cc60e30f
treeb690d81f844573b0b22627a87599d072205df249
parent522c1eb4d2f5faf1fa87be07d9617df1439fc0d6
LU-7727 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 mdt
if the open request is from a read only client.
We also do a similar check on the client so we can fail with EROFS
straight away without sending the rpc to mdt.

Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
Change-Id: I8b08e9d100a1ab8edf2fa47d4e2ebc5170f36df5
Reviewed-on: http://review.whamcloud.com/18242
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Ian Costello <icostello@ddn.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/namei.c
lustre/mdt/mdt_open.c