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