LU-9597 ofd: fix race for project setattr
sanity-quota 33 exposed an intresting project quota bug,
problem is we could hit following condition:
step 1: create an empty file
step 2: buffer write data to file, at this time project id 0 is packed.
step 3: chattr file's project id
If write RPC is generated on client but not reaching OST yet, and step 3
chattr is issued in this time window and chattr on OST is done before
write PRC being processed on OST:
That means we have changed file's project ID, but ofd_attr_handle_id()
did not clear S_ISUID and S_ISGID for this case. Write RPC arrived on
OST, first write RPC will call ofd_attr_handle_id() to set attribute.
Unfortunately it will think this is first write as S_ISUID and S_ISGID
is set, project id will be reset with packed id 0, thus we got wrong
project accounting.
We should use another file mode to indicate whether
project id has been initialized, this patch tries to
fix this problem.
Lustre-change: https://review.whamcloud.com/28274
Lustre-commit:
fb9152406da6fe439b75244e769db7dacb20a8d1
Change-Id: Ie2f9ce5b662c3011aa1cd2f59e1fb20526a3e3d7
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/28402
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>