cfg80211: handle failed skb allocation
[cascardo/linux.git] / drivers / staging / lustre / lustre / llite / xattr.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, see
18  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
19  *
20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21  * CA 95054 USA or visit www.sun.com if you need additional information or
22  * have any questions.
23  *
24  * GPL HEADER END
25  */
26 /*
27  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28  * Use is subject to license terms.
29  *
30  * Copyright (c) 2011, 2015, Intel Corporation.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  */
36
37 #include <linux/fs.h>
38 #include <linux/sched.h>
39 #include <linux/mm.h>
40 #include <linux/selinux.h>
41
42 #define DEBUG_SUBSYSTEM S_LLITE
43
44 #include "../include/obd_support.h"
45 #include "../include/lustre_lite.h"
46 #include "../include/lustre_dlm.h"
47 #include "../include/lustre_ver.h"
48 #include "../include/lustre_eacl.h"
49
50 #include "llite_internal.h"
51
52 #define XATTR_USER_T        (1)
53 #define XATTR_TRUSTED_T  (2)
54 #define XATTR_SECURITY_T        (3)
55 #define XATTR_ACL_ACCESS_T      (4)
56 #define XATTR_ACL_DEFAULT_T     (5)
57 #define XATTR_LUSTRE_T    (6)
58 #define XATTR_OTHER_T      (7)
59
60 static
61 int get_xattr_type(const char *name)
62 {
63         if (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS))
64                 return XATTR_ACL_ACCESS_T;
65
66         if (!strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT))
67                 return XATTR_ACL_DEFAULT_T;
68
69         if (!strncmp(name, XATTR_USER_PREFIX,
70                      sizeof(XATTR_USER_PREFIX) - 1))
71                 return XATTR_USER_T;
72
73         if (!strncmp(name, XATTR_TRUSTED_PREFIX,
74                      sizeof(XATTR_TRUSTED_PREFIX) - 1))
75                 return XATTR_TRUSTED_T;
76
77         if (!strncmp(name, XATTR_SECURITY_PREFIX,
78                      sizeof(XATTR_SECURITY_PREFIX) - 1))
79                 return XATTR_SECURITY_T;
80
81         if (!strncmp(name, XATTR_LUSTRE_PREFIX,
82                      sizeof(XATTR_LUSTRE_PREFIX) - 1))
83                 return XATTR_LUSTRE_T;
84
85         return XATTR_OTHER_T;
86 }
87
88 static
89 int xattr_type_filter(struct ll_sb_info *sbi, int xattr_type)
90 {
91         if ((xattr_type == XATTR_ACL_ACCESS_T ||
92              xattr_type == XATTR_ACL_DEFAULT_T) &&
93            !(sbi->ll_flags & LL_SBI_ACL))
94                 return -EOPNOTSUPP;
95
96         if (xattr_type == XATTR_USER_T && !(sbi->ll_flags & LL_SBI_USER_XATTR))
97                 return -EOPNOTSUPP;
98         if (xattr_type == XATTR_TRUSTED_T && !capable(CFS_CAP_SYS_ADMIN))
99                 return -EPERM;
100         if (xattr_type == XATTR_OTHER_T)
101                 return -EOPNOTSUPP;
102
103         return 0;
104 }
105
106 static
107 int ll_setxattr_common(struct inode *inode, const char *name,
108                        const void *value, size_t size,
109                        int flags, __u64 valid)
110 {
111         struct ll_sb_info *sbi = ll_i2sbi(inode);
112         struct ptlrpc_request *req = NULL;
113         int xattr_type, rc;
114 #ifdef CONFIG_FS_POSIX_ACL
115         struct rmtacl_ctl_entry *rce = NULL;
116         posix_acl_xattr_header *new_value = NULL;
117         ext_acl_xattr_header *acl = NULL;
118 #endif
119         const char *pv = value;
120
121         xattr_type = get_xattr_type(name);
122         rc = xattr_type_filter(sbi, xattr_type);
123         if (rc)
124                 return rc;
125
126         if ((xattr_type == XATTR_ACL_ACCESS_T ||
127              xattr_type == XATTR_ACL_DEFAULT_T) &&
128             !inode_owner_or_capable(inode))
129                 return -EPERM;
130
131         /* b10667: ignore lustre special xattr for now */
132         if ((xattr_type == XATTR_TRUSTED_T && strcmp(name, "trusted.lov") == 0) ||
133             (xattr_type == XATTR_LUSTRE_T && strcmp(name, "lustre.lov") == 0))
134                 return 0;
135
136         /* b15587: ignore security.capability xattr for now */
137         if ((xattr_type == XATTR_SECURITY_T &&
138              strcmp(name, "security.capability") == 0))
139                 return 0;
140
141         /* LU-549:  Disable security.selinux when selinux is disabled */
142         if (xattr_type == XATTR_SECURITY_T && !selinux_is_enabled() &&
143             strcmp(name, "security.selinux") == 0)
144                 return -EOPNOTSUPP;
145
146 #ifdef CONFIG_FS_POSIX_ACL
147         if (sbi->ll_flags & LL_SBI_RMT_CLIENT &&
148             (xattr_type == XATTR_ACL_ACCESS_T ||
149             xattr_type == XATTR_ACL_DEFAULT_T)) {
150                 rce = rct_search(&sbi->ll_rct, current_pid());
151                 if (!rce ||
152                     (rce->rce_ops != RMT_LSETFACL &&
153                     rce->rce_ops != RMT_RSETFACL))
154                         return -EOPNOTSUPP;
155
156                 if (rce->rce_ops == RMT_LSETFACL) {
157                         struct eacl_entry *ee;
158
159                         ee = et_search_del(&sbi->ll_et, current_pid(),
160                                            ll_inode2fid(inode), xattr_type);
161                         if (valid & OBD_MD_FLXATTR) {
162                                 acl = lustre_acl_xattr_merge2ext(
163                                                 (posix_acl_xattr_header *)value,
164                                                 size, ee->ee_acl);
165                                 if (IS_ERR(acl)) {
166                                         ee_free(ee);
167                                         return PTR_ERR(acl);
168                                 }
169                                 size =  CFS_ACL_XATTR_SIZE(\
170                                                 le32_to_cpu(acl->a_count), \
171                                                 ext_acl_xattr);
172                                 pv = (const char *)acl;
173                         }
174                         ee_free(ee);
175                 } else if (rce->rce_ops == RMT_RSETFACL) {
176                         rc = lustre_posix_acl_xattr_filter(
177                                                 (posix_acl_xattr_header *)value,
178                                                 size, &new_value);
179                         if (unlikely(rc < 0))
180                                 return rc;
181                         size = rc;
182
183                         pv = (const char *)new_value;
184                 } else {
185                         return -EOPNOTSUPP;
186                 }
187
188                 valid |= rce_ops2valid(rce->rce_ops);
189         }
190 #endif
191         rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode),
192                          valid, name, pv, size, 0, flags,
193                          ll_i2suppgid(inode), &req);
194 #ifdef CONFIG_FS_POSIX_ACL
195         /*
196          * Release the posix ACL space.
197          */
198         kfree(new_value);
199         if (acl)
200                 lustre_ext_acl_xattr_free(acl);
201 #endif
202         if (rc) {
203                 if (rc == -EOPNOTSUPP && xattr_type == XATTR_USER_T) {
204                         LCONSOLE_INFO("Disabling user_xattr feature because it is not supported on the server\n");
205                         sbi->ll_flags &= ~LL_SBI_USER_XATTR;
206                 }
207                 return rc;
208         }
209
210         ptlrpc_req_finished(req);
211         return 0;
212 }
213
214 int ll_setxattr(struct dentry *dentry, const char *name,
215                 const void *value, size_t size, int flags)
216 {
217         struct inode *inode = d_inode(dentry);
218
219         LASSERT(inode);
220         LASSERT(name);
221
222         CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n",
223                PFID(ll_inode2fid(inode)), inode, name);
224
225         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_SETXATTR, 1);
226
227         if ((strncmp(name, XATTR_TRUSTED_PREFIX,
228                      sizeof(XATTR_TRUSTED_PREFIX) - 1) == 0 &&
229              strcmp(name + sizeof(XATTR_TRUSTED_PREFIX) - 1, "lov") == 0) ||
230             (strncmp(name, XATTR_LUSTRE_PREFIX,
231                      sizeof(XATTR_LUSTRE_PREFIX) - 1) == 0 &&
232              strcmp(name + sizeof(XATTR_LUSTRE_PREFIX) - 1, "lov") == 0)) {
233                 struct lov_user_md *lump = (struct lov_user_md *)value;
234                 int rc = 0;
235
236                 if (size != 0 && size < sizeof(struct lov_user_md))
237                         return -EINVAL;
238
239                 /* Attributes that are saved via getxattr will always have
240                  * the stripe_offset as 0.  Instead, the MDS should be
241                  * allowed to pick the starting OST index.   b=17846
242                  */
243                 if (lump && lump->lmm_stripe_offset == 0)
244                         lump->lmm_stripe_offset = -1;
245
246                 if (lump && S_ISREG(inode->i_mode)) {
247                         __u64 it_flags = FMODE_WRITE;
248                         int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ?
249                                 sizeof(*lump) : sizeof(struct lov_user_md_v3);
250
251                         rc = ll_lov_setstripe_ea_info(inode, dentry, it_flags,
252                                                       lump, lum_size);
253                         /* b10667: rc always be 0 here for now */
254                         rc = 0;
255                 } else if (S_ISDIR(inode->i_mode)) {
256                         rc = ll_dir_setstripe(inode, lump, 0);
257                 }
258
259                 return rc;
260
261         } else if (strcmp(name, XATTR_NAME_LMA) == 0 ||
262                    strcmp(name, XATTR_NAME_LINK) == 0)
263                 return 0;
264
265         return ll_setxattr_common(inode, name, value, size, flags,
266                                   OBD_MD_FLXATTR);
267 }
268
269 int ll_removexattr(struct dentry *dentry, const char *name)
270 {
271         struct inode *inode = d_inode(dentry);
272
273         LASSERT(inode);
274         LASSERT(name);
275
276         CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n",
277                PFID(ll_inode2fid(inode)), inode, name);
278
279         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_REMOVEXATTR, 1);
280         return ll_setxattr_common(inode, name, NULL, 0, 0,
281                                   OBD_MD_FLXATTRRM);
282 }
283
284 static
285 int ll_getxattr_common(struct inode *inode, const char *name,
286                        void *buffer, size_t size, __u64 valid)
287 {
288         struct ll_sb_info *sbi = ll_i2sbi(inode);
289         struct ptlrpc_request *req = NULL;
290         struct mdt_body *body;
291         int xattr_type, rc;
292         void *xdata;
293         struct rmtacl_ctl_entry *rce = NULL;
294         struct ll_inode_info *lli = ll_i2info(inode);
295
296         CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
297                PFID(ll_inode2fid(inode)), inode);
298
299         /* listxattr have slightly different behavior from of ext3:
300          * without 'user_xattr' ext3 will list all xattr names but
301          * filtered out "^user..*"; we list them all for simplicity.
302          */
303         if (!name) {
304                 xattr_type = XATTR_OTHER_T;
305                 goto do_getxattr;
306         }
307
308         xattr_type = get_xattr_type(name);
309         rc = xattr_type_filter(sbi, xattr_type);
310         if (rc)
311                 return rc;
312
313         /* b15587: ignore security.capability xattr for now */
314         if ((xattr_type == XATTR_SECURITY_T &&
315              strcmp(name, "security.capability") == 0))
316                 return -ENODATA;
317
318         /* LU-549:  Disable security.selinux when selinux is disabled */
319         if (xattr_type == XATTR_SECURITY_T && !selinux_is_enabled() &&
320             strcmp(name, "security.selinux") == 0)
321                 return -EOPNOTSUPP;
322
323 #ifdef CONFIG_FS_POSIX_ACL
324         if (sbi->ll_flags & LL_SBI_RMT_CLIENT &&
325             (xattr_type == XATTR_ACL_ACCESS_T ||
326             xattr_type == XATTR_ACL_DEFAULT_T)) {
327                 rce = rct_search(&sbi->ll_rct, current_pid());
328                 if (!rce ||
329                     (rce->rce_ops != RMT_LSETFACL &&
330                     rce->rce_ops != RMT_LGETFACL &&
331                     rce->rce_ops != RMT_RSETFACL &&
332                     rce->rce_ops != RMT_RGETFACL))
333                         return -EOPNOTSUPP;
334         }
335
336         /* posix acl is under protection of LOOKUP lock. when calling to this,
337          * we just have path resolution to the target inode, so we have great
338          * chance that cached ACL is uptodate.
339          */
340         if (xattr_type == XATTR_ACL_ACCESS_T &&
341             !(sbi->ll_flags & LL_SBI_RMT_CLIENT)) {
342                 struct posix_acl *acl;
343
344                 spin_lock(&lli->lli_lock);
345                 acl = posix_acl_dup(lli->lli_posix_acl);
346                 spin_unlock(&lli->lli_lock);
347
348                 if (!acl)
349                         return -ENODATA;
350
351                 rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
352                 posix_acl_release(acl);
353                 return rc;
354         }
355         if (xattr_type == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode))
356                 return -ENODATA;
357 #endif
358
359 do_getxattr:
360         if (sbi->ll_xattr_cache_enabled && xattr_type != XATTR_ACL_ACCESS_T) {
361                 rc = ll_xattr_cache_get(inode, name, buffer, size, valid);
362                 if (rc == -EAGAIN)
363                         goto getxattr_nocache;
364                 if (rc < 0)
365                         goto out_xattr;
366
367                 /* Add "system.posix_acl_access" to the list */
368                 if (lli->lli_posix_acl && valid & OBD_MD_FLXATTRLS) {
369                         if (size == 0) {
370                                 rc += sizeof(XATTR_NAME_ACL_ACCESS);
371                         } else if (size - rc >= sizeof(XATTR_NAME_ACL_ACCESS)) {
372                                 memcpy(buffer + rc, XATTR_NAME_ACL_ACCESS,
373                                        sizeof(XATTR_NAME_ACL_ACCESS));
374                                 rc += sizeof(XATTR_NAME_ACL_ACCESS);
375                         } else {
376                                 rc = -ERANGE;
377                                 goto out_xattr;
378                         }
379                 }
380         } else {
381 getxattr_nocache:
382                 rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode),
383                                 valid | (rce ? rce_ops2valid(rce->rce_ops) : 0),
384                                 name, NULL, 0, size, 0, &req);
385
386                 if (rc < 0)
387                         goto out_xattr;
388
389                 body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
390                 LASSERT(body);
391
392                 /* only detect the xattr size */
393                 if (size == 0) {
394                         rc = body->eadatasize;
395                         goto out;
396                 }
397
398                 if (size < body->eadatasize) {
399                         CERROR("server bug: replied size %u > %u\n",
400                                body->eadatasize, (int)size);
401                         rc = -ERANGE;
402                         goto out;
403                 }
404
405                 if (body->eadatasize == 0) {
406                         rc = -ENODATA;
407                         goto out;
408                 }
409
410                 /* do not need swab xattr data */
411                 xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA,
412                                                      body->eadatasize);
413                 if (!xdata) {
414                         rc = -EFAULT;
415                         goto out;
416                 }
417
418                 memcpy(buffer, xdata, body->eadatasize);
419                 rc = body->eadatasize;
420         }
421
422 #ifdef CONFIG_FS_POSIX_ACL
423         if (rce && rce->rce_ops == RMT_LSETFACL) {
424                 ext_acl_xattr_header *acl;
425
426                 acl = lustre_posix_acl_xattr_2ext(buffer, rc);
427                 if (IS_ERR(acl)) {
428                         rc = PTR_ERR(acl);
429                         goto out;
430                 }
431
432                 rc = ee_add(&sbi->ll_et, current_pid(), ll_inode2fid(inode),
433                             xattr_type, acl);
434                 if (unlikely(rc < 0)) {
435                         lustre_ext_acl_xattr_free(acl);
436                         goto out;
437                 }
438         }
439 #endif
440
441 out_xattr:
442         if (rc == -EOPNOTSUPP && xattr_type == XATTR_USER_T) {
443                 LCONSOLE_INFO(
444                         "%s: disabling user_xattr feature because it is not supported on the server: rc = %d\n",
445                         ll_get_fsname(inode->i_sb, NULL, 0), rc);
446                 sbi->ll_flags &= ~LL_SBI_USER_XATTR;
447         }
448 out:
449         ptlrpc_req_finished(req);
450         return rc;
451 }
452
453 ssize_t ll_getxattr(struct dentry *dentry, struct inode *inode,
454                     const char *name, void *buffer, size_t size)
455 {
456         LASSERT(inode);
457         LASSERT(name);
458
459         CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), xattr %s\n",
460                PFID(ll_inode2fid(inode)), inode, name);
461
462         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_GETXATTR, 1);
463
464         if ((strncmp(name, XATTR_TRUSTED_PREFIX,
465                      sizeof(XATTR_TRUSTED_PREFIX) - 1) == 0 &&
466              strcmp(name + sizeof(XATTR_TRUSTED_PREFIX) - 1, "lov") == 0) ||
467             (strncmp(name, XATTR_LUSTRE_PREFIX,
468                      sizeof(XATTR_LUSTRE_PREFIX) - 1) == 0 &&
469              strcmp(name + sizeof(XATTR_LUSTRE_PREFIX) - 1, "lov") == 0)) {
470                 struct lov_stripe_md *lsm;
471                 struct lov_user_md *lump;
472                 struct lov_mds_md *lmm = NULL;
473                 struct ptlrpc_request *request = NULL;
474                 int rc = 0, lmmsize = 0;
475
476                 if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
477                         return -ENODATA;
478
479                 if (size == 0 && S_ISDIR(inode->i_mode)) {
480                         /* XXX directory EA is fix for now, optimize to save
481                          * RPC transfer
482                          */
483                         rc = sizeof(struct lov_user_md);
484                         goto out;
485                 }
486
487                 lsm = ccc_inode_lsm_get(inode);
488                 if (!lsm) {
489                         if (S_ISDIR(inode->i_mode)) {
490                                 rc = ll_dir_getstripe(inode, &lmm,
491                                                       &lmmsize, &request);
492                         } else {
493                                 rc = -ENODATA;
494                         }
495                 } else {
496                         /* LSM is present already after lookup/getattr call.
497                          * we need to grab layout lock once it is implemented
498                          */
499                         rc = obd_packmd(ll_i2dtexp(inode), &lmm, lsm);
500                         lmmsize = rc;
501                 }
502                 ccc_inode_lsm_put(inode, lsm);
503
504                 if (rc < 0)
505                         goto out;
506
507                 if (size == 0) {
508                         /* used to call ll_get_max_mdsize() forward to get
509                          * the maximum buffer size, while some apps (such as
510                          * rsync 3.0.x) care much about the exact xattr value
511                          * size
512                          */
513                         rc = lmmsize;
514                         goto out;
515                 }
516
517                 if (size < lmmsize) {
518                         CERROR("server bug: replied size %d > %d for %pd (%s)\n",
519                                lmmsize, (int)size, dentry, name);
520                         rc = -ERANGE;
521                         goto out;
522                 }
523
524                 lump = buffer;
525                 memcpy(lump, lmm, lmmsize);
526                 /* do not return layout gen for getxattr otherwise it would
527                  * confuse tar --xattr by recognizing layout gen as stripe
528                  * offset when the file is restored. See LU-2809.
529                  */
530                 lump->lmm_layout_gen = 0;
531
532                 rc = lmmsize;
533 out:
534                 if (request)
535                         ptlrpc_req_finished(request);
536                 else if (lmm)
537                         obd_free_diskmd(ll_i2dtexp(inode), &lmm);
538                 return rc;
539         }
540
541         return ll_getxattr_common(inode, name, buffer, size, OBD_MD_FLXATTR);
542 }
543
544 ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)
545 {
546         struct inode *inode = d_inode(dentry);
547         int rc = 0, rc2 = 0;
548         struct lov_mds_md *lmm = NULL;
549         struct ptlrpc_request *request = NULL;
550         int lmmsize;
551
552         LASSERT(inode);
553
554         CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
555                PFID(ll_inode2fid(inode)), inode);
556
557         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LISTXATTR, 1);
558
559         rc = ll_getxattr_common(inode, NULL, buffer, size, OBD_MD_FLXATTRLS);
560         if (rc < 0)
561                 goto out;
562
563         if (buffer) {
564                 struct ll_sb_info *sbi = ll_i2sbi(inode);
565                 char *xattr_name = buffer;
566                 int xlen, rem = rc;
567
568                 while (rem > 0) {
569                         xlen = strnlen(xattr_name, rem - 1) + 1;
570                         rem -= xlen;
571                         if (xattr_type_filter(sbi,
572                                         get_xattr_type(xattr_name)) == 0) {
573                                 /* skip OK xattr type
574                                  * leave it in buffer
575                                  */
576                                 xattr_name += xlen;
577                                 continue;
578                         }
579                         /* move up remaining xattrs in buffer
580                          * removing the xattr that is not OK
581                          */
582                         memmove(xattr_name, xattr_name + xlen, rem);
583                         rc -= xlen;
584                 }
585         }
586         if (S_ISREG(inode->i_mode)) {
587                 if (!ll_i2info(inode)->lli_has_smd)
588                         rc2 = -1;
589         } else if (S_ISDIR(inode->i_mode)) {
590                 rc2 = ll_dir_getstripe(inode, &lmm, &lmmsize, &request);
591         }
592
593         if (rc2 < 0) {
594                 rc2 = 0;
595                 goto out;
596         } else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {
597                 const int prefix_len = sizeof(XATTR_LUSTRE_PREFIX) - 1;
598                 const size_t name_len   = sizeof("lov") - 1;
599                 const size_t total_len  = prefix_len + name_len + 1;
600
601                 if (((rc + total_len) > size) && buffer) {
602                         ptlrpc_req_finished(request);
603                         return -ERANGE;
604                 }
605
606                 if (buffer) {
607                         buffer += rc;
608                         memcpy(buffer, XATTR_LUSTRE_PREFIX, prefix_len);
609                         memcpy(buffer + prefix_len, "lov", name_len);
610                         buffer[prefix_len + name_len] = '\0';
611                 }
612                 rc2 = total_len;
613         }
614 out:
615         ptlrpc_req_finished(request);
616         rc = rc + rc2;
617
618         return rc;
619 }