Whamcloud - gitweb
LU-11017 quota: ignore quota for CAP_SYS_RESOURCE properly
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_quota.c
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 021110-1307, USA
20  *
21  * GPL HEADER END
22  */
23 /*
24  * Copyright (c) 2012, 2017, Intel Corporation.
25  * Use is subject to license terms.
26  *
27  * Author: Johann Lombardi <johann@whamcloud.com>
28  * Author: Niu    Yawei    <niu@whamcloud.com>
29  */
30
31 #include <lustre_quota.h>
32 #include "osd_internal.h"
33
34 /**
35  * Helpers function to find out the quota type (USRQUOTA/GRPQUOTA) of a
36  * given object
37  */
38 static inline int fid2type(const struct lu_fid *fid)
39 {
40         LASSERT(fid_is_acct(fid));
41         switch (fid_oid(fid)) {
42         case ACCT_USER_OID:
43                 return USRQUOTA;
44         case ACCT_GROUP_OID:
45                 return GRPQUOTA;
46         case ACCT_PROJECT_OID:
47                 return PRJQUOTA;
48         }
49
50         LASSERTF(0, "invalid fid for quota type: %u", fid_oid(fid));
51         return USRQUOTA;
52 }
53
54 /**
55  * Space Accounting Management
56  */
57
58 /**
59  * Look up an accounting object based on its fid.
60  *
61  * \param info - is the osd thread info passed by the caller
62  * \param osd  - is the osd device
63  * \param fid  - is the fid of the accounting object we want to look up
64  * \param id   - is the osd_inode_id struct to fill with the inode number of
65  *               the quota file if the lookup is successful
66  */
67 int osd_acct_obj_lookup(struct osd_thread_info *info, struct osd_device *osd,
68                         const struct lu_fid *fid, struct osd_inode_id *id)
69 {
70         struct super_block *sb = osd_sb(osd);
71
72         ENTRY;
73         LASSERT(fid_is_acct(fid));
74
75         if (!ldiskfs_has_feature_quota(sb))
76                 RETURN(-ENOENT);
77
78         id->oii_gen = OSD_OII_NOGEN;
79         switch (fid2type(fid)) {
80         case USRQUOTA:
81                 id->oii_ino =
82                         le32_to_cpu(LDISKFS_SB(sb)->s_es->s_usr_quota_inum);
83                 break;
84         case GRPQUOTA:
85                 id->oii_ino =
86                         le32_to_cpu(LDISKFS_SB(sb)->s_es->s_grp_quota_inum);
87                 break;
88         case PRJQUOTA:
89  #ifdef HAVE_PROJECT_QUOTA
90                 if (ldiskfs_has_feature_project(sb))
91                         id->oii_ino =
92                                 le32_to_cpu(LDISKFS_SB(sb)->s_es->s_prj_quota_inum);
93                 else
94  #endif
95                         RETURN(-ENOENT);
96                 break;
97         }
98         if (!ldiskfs_valid_inum(sb, id->oii_ino))
99                 RETURN(-ENOENT);
100         RETURN(0);
101 }
102
103 /**
104  * Return space usage (#blocks & #inodes) consumed by a given uid or gid.
105  *
106  * \param env   - is the environment passed by the caller
107  * \param dtobj - is the accounting object
108  * \param dtrec - is the record to fill with space usage information
109  * \param dtkey - is the id of the user or group for which we would
110  *                like to access disk usage.
111  *
112  * \retval +ve - success : exact match
113  * \retval -ve - failure
114  */
115 static int osd_acct_index_lookup(const struct lu_env *env,
116                                  struct dt_object *dtobj,
117                                  struct dt_rec *dtrec,
118                                  const struct dt_key *dtkey)
119 {
120         struct osd_thread_info  *info = osd_oti_get(env);
121 #if defined(HAVE_DQUOT_QC_DQBLK)
122         struct qc_dqblk         *dqblk = &info->oti_qdq;
123 #elif defined(HAVE_DQUOT_FS_DISK_QUOTA)
124         struct fs_disk_quota    *dqblk = &info->oti_fdq;
125 #else
126         struct if_dqblk         *dqblk = &info->oti_dqblk;
127 #endif
128         struct super_block      *sb = osd_sb(osd_obj2dev(osd_dt_obj(dtobj)));
129         struct lquota_acct_rec  *rec = (struct lquota_acct_rec *)dtrec;
130         __u64                    id = *((__u64 *)dtkey);
131         int                      rc;
132 #ifdef HAVE_DQUOT_KQID
133         struct kqid              qid;
134 #endif
135         int type;
136
137         ENTRY;
138
139         type = fid2type(lu_object_fid(&dtobj->do_lu));
140         memset(dqblk, 0, sizeof(*dqblk));
141 #ifdef HAVE_DQUOT_KQID
142         qid = make_kqid(&init_user_ns, type, id);
143         rc = sb->s_qcop->get_dqblk(sb, qid, dqblk);
144 #else
145         rc = sb->s_qcop->get_dqblk(sb, type, (qid_t) id, dqblk);
146 #endif
147         if (rc)
148                 RETURN(rc);
149 #if defined(HAVE_DQUOT_QC_DQBLK)
150         rec->bspace = dqblk->d_space;
151         rec->ispace = dqblk->d_ino_count;
152 #elif defined(HAVE_DQUOT_FS_DISK_QUOTA)
153         rec->bspace = dqblk->d_bcount;
154         rec->ispace = dqblk->d_icount;
155 #else
156         rec->bspace = dqblk->dqb_curspace;
157         rec->ispace = dqblk->dqb_curinodes;
158 #endif
159         RETURN(+1);
160 }
161
162 #define QUOTA_IT_READ_ERROR(it, rc)                                    \
163         CERROR("%s: Error while trying to read quota information, "    \
164                "failed with %d\n",                                     \
165                osd_dev(it->oiq_obj->oo_dt.do_lu.lo_dev)->od_svname, rc); \
166
167 /**
168  * Initialize osd Iterator for given osd index object.
169  *
170  * \param  dt    - osd index object
171  * \param  attr  - not used
172  */
173 static struct dt_it *osd_it_acct_init(const struct lu_env *env,
174                                       struct dt_object *dt,
175                                       __u32 attr)
176 {
177         struct osd_it_quota     *it;
178         struct lu_object        *lo = &dt->do_lu;
179         struct osd_object       *obj = osd_dt_obj(dt);
180
181         ENTRY;
182
183         LASSERT(lu_object_exists(lo));
184
185         OBD_ALLOC_PTR(it);
186         if (it == NULL)
187                 RETURN(ERR_PTR(-ENOMEM));
188
189         lu_object_get(lo);
190         it->oiq_obj = obj;
191         INIT_LIST_HEAD(&it->oiq_list);
192
193         /* LUSTRE_DQTREEOFF is the initial offset where the tree can be found */
194         it->oiq_blk[0] = LUSTRE_DQTREEOFF;
195
196         /* NB: we don't need to store the tree depth since it is always
197          * equal to LUSTRE_DQTREEDEPTH - 1 (root has depth = 0) for a leaf
198          * block. */
199         RETURN((struct dt_it *)it);
200 }
201
202 /**
203  * Free given iterator.
204  *
205  * \param  di   - osd iterator
206  */
207 static void osd_it_acct_fini(const struct lu_env *env, struct dt_it *di)
208 {
209         struct osd_it_quota *it = (struct osd_it_quota *)di;
210         struct osd_quota_leaf *leaf, *tmp;
211         ENTRY;
212
213         osd_object_put(env, it->oiq_obj);
214
215         list_for_each_entry_safe(leaf, tmp, &it->oiq_list, oql_link) {
216                 list_del_init(&leaf->oql_link);
217                 OBD_FREE_PTR(leaf);
218         }
219
220         OBD_FREE_PTR(it);
221
222         EXIT;
223 }
224
225 /**
226  * Move Iterator to record specified by \a key, if the \a key isn't found,
227  * move to the first valid record.
228  *
229  * \param  di   - osd iterator
230  * \param  key  - uid or gid
231  *
232  * \retval +ve  - di points to the first valid record
233  * \retval  +1  - di points to exact matched key
234  * \retval -ve  - failure
235  */
236 static int osd_it_acct_get(const struct lu_env *env, struct dt_it *di,
237                            const struct dt_key *key)
238 {
239         struct osd_it_quota     *it = (struct osd_it_quota *)di;
240         const struct lu_fid     *fid =
241                                 lu_object_fid(&it->oiq_obj->oo_dt.do_lu);
242         int                      type;
243         qid_t                    dqid = *(qid_t *)key;
244         loff_t                   offset;
245         int                      rc;
246
247         ENTRY;
248         type = fid2type(fid);
249
250         offset = find_tree_dqentry(env, it->oiq_obj, type, dqid,
251                                    LUSTRE_DQTREEOFF, 0, it);
252         if (offset > 0) { /* Found */
253                 RETURN(+1);
254         } else if (offset < 0) { /* Error */
255                 QUOTA_IT_READ_ERROR(it, (int)offset);
256                 RETURN((int)offset);
257         }
258
259         /* The @key is not found, move to the first valid entry */
260         rc = walk_tree_dqentry(env, it->oiq_obj, type, it->oiq_blk[0], 0,
261                                0, it);
262         if (rc == 0)
263                 rc = 1;
264         else if (rc > 0)
265                 rc = -ENOENT;
266
267         RETURN(rc);
268 }
269
270 /**
271  * Release Iterator
272  *
273  * \param  di   - osd iterator
274  */
275 static void osd_it_acct_put(const struct lu_env *env, struct dt_it *di)
276 {
277         return;
278 }
279
280 static int osd_it_add_processed(struct osd_it_quota *it, int depth)
281 {
282         struct osd_quota_leaf *leaf;
283
284         OBD_ALLOC_PTR(leaf);
285         if (leaf == NULL)
286                 RETURN(-ENOMEM);
287         INIT_LIST_HEAD(&leaf->oql_link);
288         leaf->oql_blk = it->oiq_blk[depth];
289         list_add_tail(&leaf->oql_link, &it->oiq_list);
290         RETURN(0);
291 }
292
293 /**
294  * Move on to the next valid entry.
295  *
296  * \param  di   - osd iterator
297  *
298  * \retval +ve  - iterator reached the end
299  * \retval   0  - iterator has not reached the end yet
300  * \retval -ve  - unexpected failure
301  */
302 static int osd_it_acct_next(const struct lu_env *env, struct dt_it *di)
303 {
304         struct osd_it_quota     *it = (struct osd_it_quota *)di;
305         const struct lu_fid     *fid =
306                                 lu_object_fid(&it->oiq_obj->oo_dt.do_lu);
307         int                      type;
308         int                      depth, rc;
309         uint                     index;
310
311         ENTRY;
312
313         type = fid2type(fid);
314
315         /* Let's first check if there are any remaining valid entry in the
316          * current leaf block. Start with the next entry after the current one.
317          */
318         depth = LUSTRE_DQTREEDEPTH;
319         index = it->oiq_index[depth];
320         if (++index < LUSTRE_DQSTRINBLK) {
321                 /* Search for the next valid entry from current index */
322                 rc = walk_block_dqentry(env, it->oiq_obj, type,
323                                         it->oiq_blk[depth], index, it);
324                 if (rc < 0) {
325                         QUOTA_IT_READ_ERROR(it, rc);
326                         RETURN(rc);
327                 } else if (rc == 0) {
328                         /* Found on entry, @it is already updated to the
329                          * new position in walk_block_dqentry(). */
330                         RETURN(0);
331                 } else {
332                         rc = osd_it_add_processed(it, depth);
333                         if (rc)
334                                 RETURN(rc);
335                 }
336         } else {
337                 rc = osd_it_add_processed(it, depth);
338                 if (rc)
339                         RETURN(rc);
340         }
341         rc = 1;
342
343         /* We have consumed all the entries of the current leaf block, move on
344          * to the next one. */
345         depth--;
346
347         /* We keep searching as long as walk_tree_dqentry() returns +1
348          * (= no valid entry found). */
349         for (; depth >= 0 && rc > 0; depth--) {
350                 index = it->oiq_index[depth];
351                 if (++index > 0xff)
352                         continue;
353                 rc = walk_tree_dqentry(env, it->oiq_obj, type,
354                                        it->oiq_blk[depth], depth, index, it);
355         }
356
357         if (rc < 0)
358                 QUOTA_IT_READ_ERROR(it, rc);
359         RETURN(rc);
360 }
361
362 /**
363  * Return pointer to the key under iterator.
364  *
365  * \param  di   - osd iterator
366  */
367 static struct dt_key *osd_it_acct_key(const struct lu_env *env,
368                                       const struct dt_it *di)
369 {
370         struct osd_it_quota *it = (struct osd_it_quota *)di;
371
372         ENTRY;
373         RETURN((struct dt_key *)&it->oiq_id);
374 }
375
376 /**
377  * Return size of key under iterator (in bytes)
378  *
379  * \param  di   - osd iterator
380  */
381 static int osd_it_acct_key_size(const struct lu_env *env,
382                                 const struct dt_it *di)
383 {
384         struct osd_it_quota *it = (struct osd_it_quota *)di;
385
386         ENTRY;
387         RETURN((int)sizeof(it->oiq_id));
388 }
389
390 /**
391  * Return pointer to the record under iterator.
392  *
393  * \param  di    - osd iterator
394  * \param  attr  - not used
395  */
396 static int osd_it_acct_rec(const struct lu_env *env,
397                            const struct dt_it *di,
398                            struct dt_rec *dtrec, __u32 attr)
399 {
400         struct osd_it_quota     *it = (struct osd_it_quota *)di;
401         const struct dt_key     *key = osd_it_acct_key(env, di);
402         int                      rc;
403
404         ENTRY;
405
406         rc = osd_acct_index_lookup(env, &it->oiq_obj->oo_dt, dtrec, key);
407         RETURN(rc > 0 ? 0 : rc);
408 }
409
410 /**
411  * Returns cookie for current Iterator position.
412  *
413  * \param  di    - osd iterator
414  */
415 static __u64 osd_it_acct_store(const struct lu_env *env,
416                                const struct dt_it *di)
417 {
418         struct osd_it_quota *it = (struct osd_it_quota *)di;
419
420         ENTRY;
421         RETURN(it->oiq_id);
422 }
423
424 /**
425  * Restore iterator from cookie. if the \a hash isn't found,
426  * restore the first valid record.
427  *
428  * \param  di    - osd iterator
429  * \param  hash  - iterator location cookie
430  *
431  * \retval +ve   - di points to the first valid record
432  * \retval  +1   - di points to exact matched hash
433  * \retval -ve   - failure
434  */
435 static int osd_it_acct_load(const struct lu_env *env,
436                             const struct dt_it *di, __u64 hash)
437 {
438         struct osd_it_quota *it = (struct osd_it_quota *)di;
439
440         ENTRY;
441
442         /* LU-8999 - If it is called to resume the iteration, calling
443          * osd_it_acct_get could change the block orders in the lower level
444          * of the quota tree, which are saved in osd_it_quota->oiq_blk.
445          * */
446         if (it->oiq_id != 0 && it->oiq_id == hash)
447                 RETURN(1);
448
449         RETURN(osd_it_acct_get(env, (struct dt_it *)di,
450                                (const struct dt_key *)&hash));
451 }
452
453 /**
454  * Index and Iterator operations for accounting objects
455  */
456 const struct dt_index_operations osd_acct_index_ops = {
457         .dio_lookup     = osd_acct_index_lookup,
458         .dio_it         = {
459                 .init           = osd_it_acct_init,
460                 .fini           = osd_it_acct_fini,
461                 .get            = osd_it_acct_get,
462                 .put            = osd_it_acct_put,
463                 .next           = osd_it_acct_next,
464                 .key            = osd_it_acct_key,
465                 .key_size       = osd_it_acct_key_size,
466                 .rec            = osd_it_acct_rec,
467                 .store          = osd_it_acct_store,
468                 .load           = osd_it_acct_load
469         }
470 };
471
472 static inline void osd_quota_swab(char *ptr, size_t size)
473 {
474         int offset;
475
476         LASSERT((size & (sizeof(__u64) - 1)) == 0);
477
478         for (offset = 0; offset < size; offset += sizeof(__u64))
479              __swab64s((__u64 *)(ptr + offset));
480 }
481
482 const struct dt_rec *osd_quota_pack(struct osd_object *obj,
483                                     const struct dt_rec *rec,
484                                     union lquota_rec *quota_rec)
485 {
486 #ifdef __BIG_ENDIAN
487         struct iam_descr        *descr;
488
489         LASSERT(obj->oo_dir != NULL);
490         descr = obj->oo_dir->od_container.ic_descr;
491
492         memcpy(quota_rec, rec, descr->id_rec_size);
493
494         osd_quota_swab((char *)quota_rec, descr->id_rec_size);
495         return (const struct dt_rec *)quota_rec;
496 #else
497         return rec;
498 #endif
499 }
500
501 void osd_quota_unpack(struct osd_object *obj, const struct dt_rec *rec)
502 {
503 #ifdef __BIG_ENDIAN
504         struct iam_descr *descr;
505
506         LASSERT(obj->oo_dir != NULL);
507         descr = obj->oo_dir->od_container.ic_descr;
508
509         osd_quota_swab((char *)rec, descr->id_rec_size);
510 #else
511         return;
512 #endif
513 }
514
515 static inline int osd_qid_type(struct osd_thandle *oh, int i)
516 {
517         return oh->ot_id_types[i];
518 }
519
520 /**
521  * Reserve journal credits for quota files update first, then call
522  * ->op_begin() to perform quota enforcement.
523  *
524  * \param  env     - the environment passed by the caller
525  * \param  oh      - osd transaction handle
526  * \param  qi      - quota id & space required for this operation
527  * \param  obj     - osd object, could be NULL when it's under create
528  * \param  enforce - whether to perform quota enforcement
529  * \param  flags   - if the operation is write, return no user quota, no
530  *                   group quota, or sync commit flags to the caller
531  *
532  * \retval 0       - success
533  * \retval -ve     - failure
534  */
535 int osd_declare_qid(const struct lu_env *env, struct osd_thandle *oh,
536                     struct lquota_id_info *qi, struct osd_object *obj,
537                     bool enforce, int *flags)
538 {
539         struct osd_device       *dev;
540         struct qsd_instance     *qsd;
541         struct inode            *inode = NULL;
542         int                      i, rc = 0, crd;
543         bool                     found = false;
544         ENTRY;
545
546         LASSERT(oh != NULL);
547         LASSERTF(oh->ot_id_cnt <= OSD_MAX_UGID_CNT, "count=%d\n",
548                  oh->ot_id_cnt);
549
550         dev = osd_dt_dev(oh->ot_super.th_dev);
551         LASSERT(dev != NULL);
552
553         qsd = dev->od_quota_slave;
554
555         for (i = 0; i < oh->ot_id_cnt; i++) {
556                 if (oh->ot_id_array[i] == qi->lqi_id.qid_uid &&
557                     oh->ot_id_types[i] == qi->lqi_type) {
558                         found = true;
559                         break;
560                 }
561         }
562
563         if (!found) {
564                 /* we need to account for credits for this new ID */
565                 if (i >= OSD_MAX_UGID_CNT) {
566                         CERROR("Too many(%d) trans qids!\n", i + 1);
567                         RETURN(-EOVERFLOW);
568                 }
569
570                 if (obj != NULL)
571                         inode = obj->oo_inode;
572
573                 /* root ID entry should be always present in the quota file */
574                 if (qi->lqi_id.qid_uid == 0) {
575                         crd = 1;
576                 } else {
577                         /* used space for this ID could be dropped to zero,
578                          * reserve extra credits for removing ID entry from
579                          * the quota file */
580                         if (qi->lqi_space < 0)
581                                 crd = LDISKFS_QUOTA_DEL_BLOCKS(osd_sb(dev));
582                         /* reserve credits for adding ID entry to the quota
583                          * file if the i_dquot isn't initialized yet. */
584                         else if (inode == NULL ||
585 #ifdef HAVE_EXT4_INFO_DQUOT
586                                  LDISKFS_I(inode)->i_dquot[qi->lqi_type] == NULL)
587 #else
588                                  inode->i_dquot[qi->lqi_type] == NULL)
589 #endif
590                                 crd = LDISKFS_QUOTA_INIT_BLOCKS(osd_sb(dev));
591                         else
592                                 crd = 1;
593                 }
594
595                 osd_trans_declare_op(env, oh, OSD_OT_QUOTA, crd);
596
597                 oh->ot_id_array[i] = qi->lqi_id.qid_uid;
598                 oh->ot_id_types[i] = qi->lqi_type;
599                 oh->ot_id_cnt++;
600         }
601
602         if (unlikely(qsd == NULL))
603                 /* quota slave instance hasn't been allocated yet */
604                 RETURN(0);
605
606         /* check quota */
607         if (enforce)
608                 rc = qsd_op_begin(env, qsd, oh->ot_quota_trans, qi, flags);
609         RETURN(rc);
610 }
611
612 /**
613  * Wrapper for osd_declare_qid()
614  *
615  * \param  env    - the environment passed by the caller
616  * \param  uid    - user id of the inode
617  * \param  gid    - group id of the inode
618  * \param  space  - how many blocks/inodes will be consumed/released
619  * \param  oh     - osd transaction handle
620  * \param  obj    - osd object, could be NULL when it's under create
621  * \param  flags  - if the operation is write, return no user quota, no
622  *                  group quota, or sync commit flags to the caller
623  * \param osd_qid_flags - indicate this is a inode/block accounting
624  *                      and whether changes are performed by root user
625  *
626  * \retval 0      - success
627  * \retval -ve    - failure
628  */
629 int osd_declare_inode_qid(const struct lu_env *env, qid_t uid, qid_t gid,
630                           __u32 projid, long long space, struct osd_thandle *oh,
631                           struct osd_object *obj, int *flags,
632                           enum osd_qid_declare_flags osd_qid_declare_flags)
633 {
634         struct osd_thread_info  *info = osd_oti_get(env);
635         struct lquota_id_info   *qi = &info->oti_qi;
636         int rcu, rcg, rcp = 0; /* user & group & project rc */
637         struct thandle *th = &oh->ot_super;
638         bool force = !!(osd_qid_declare_flags & OSD_QID_FORCE) ||
639                         th->th_ignore_quota;
640         ENTRY;
641
642         /* let's start with user quota */
643         qi->lqi_id.qid_uid = uid;
644         qi->lqi_type       = USRQUOTA;
645         qi->lqi_space      = space;
646         qi->lqi_is_blk     = !!(osd_qid_declare_flags & OSD_QID_BLK);
647         rcu = osd_declare_qid(env, oh, qi, obj, true, flags);
648
649         if (force && (rcu == -EDQUOT || rcu == -EINPROGRESS))
650                 /* ignore EDQUOT & EINPROGRESS when changes are done by root */
651                 rcu = 0;
652
653         /* For non-fatal error, we want to continue to get the noquota flags
654          * for group id. This is only for commit write, which has @flags passed
655          * in. See osd_declare_write_commit().
656          * When force is set to true, we also want to proceed with the gid */
657         if (rcu && (rcu != -EDQUOT || flags == NULL))
658                 RETURN(rcu);
659
660         /* and now group quota */
661         qi->lqi_id.qid_gid = gid;
662         qi->lqi_type       = GRPQUOTA;
663         rcg = osd_declare_qid(env, oh, qi, obj, true, flags);
664
665         if (force && (rcg == -EDQUOT || rcg == -EINPROGRESS))
666                 /* as before, ignore EDQUOT & EINPROGRESS for root */
667                 rcg = 0;
668
669 #ifdef HAVE_PROJECT_QUOTA
670         if (rcg && (rcg != -EDQUOT || flags == NULL))
671                 RETURN(rcg);
672
673         /* and now project quota */
674         qi->lqi_id.qid_projid = projid;
675         qi->lqi_type = PRJQUOTA;
676         rcp = osd_declare_qid(env, oh, qi, obj, true, flags);
677
678         if (force && (rcp == -EDQUOT || rcp == -EINPROGRESS))
679                 /* as before, ignore EDQUOT & EINPROGRESS for root */
680                 rcp = 0;
681 #endif
682
683         RETURN(rcu ? rcu : (rcg ? rcg : rcp));
684 }