Whamcloud - gitweb
LU-15141 quota: optimize capability check for root squash
[fs/lustre-release.git] / lustre / osc / osc_cache.c
index 3255696..fe8a56e 100644 (file)
@@ -2304,13 +2304,23 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
 
        /* Set the OBD_BRW_SRVLOCK before the page is queued. */
        brw_flags |= ops->ops_srvlock ? OBD_BRW_SRVLOCK : 0;
-       if (oio->oi_cap_sys_resource || io->ci_noquota) {
+       if (io->ci_noquota) {
                brw_flags |= OBD_BRW_NOQUOTA;
                cmd |= OBD_BRW_NOQUOTA;
        }
 
+       if (oio->oi_cap_sys_resource) {
+               brw_flags |= OBD_BRW_SYS_RESOURCE;
+               cmd |= OBD_BRW_SYS_RESOURCE;
+       }
+
        /* check if the file's owner/group is over quota */
-       if (!io->ci_noquota) {
+       /* do not check for root without root squash, because in this case
+        * we should bypass quota
+        */
+       if ((!oio->oi_cap_sys_resource ||
+            cli->cl_root_squash) &&
+           !io->ci_noquota) {
                struct cl_object *obj;
                struct cl_attr   *attr;
                unsigned int qid[LL_MAXQUOTAS];