Line data Source code
1 : // SPDX-License-Identifier: GPL-2.0
2 : /*
3 : * Copyright (c) 2000-2005 Silicon Graphics, Inc.
4 : * Copyright (c) 2013 Red Hat, Inc.
5 : * All Rights Reserved.
6 : */
7 : #include "xfs.h"
8 : #include "xfs_fs.h"
9 : #include "xfs_shared.h"
10 : #include "xfs_format.h"
11 : #include "xfs_log_format.h"
12 : #include "xfs_trans_resv.h"
13 : #include "xfs_mount.h"
14 : #include "xfs_da_format.h"
15 : #include "xfs_inode.h"
16 : #include "xfs_trans.h"
17 : #include "xfs_bmap.h"
18 : #include "xfs_da_btree.h"
19 : #include "xfs_attr.h"
20 : #include "xfs_attr_sf.h"
21 : #include "xfs_attr_leaf.h"
22 : #include "xfs_error.h"
23 : #include "xfs_trace.h"
24 : #include "xfs_dir2.h"
25 : #include "xfs_health.h"
26 :
27 : STATIC int
28 38302351 : xfs_attr_shortform_compare(const void *a, const void *b)
29 : {
30 38302351 : xfs_attr_sf_sort_t *sa, *sb;
31 :
32 38302351 : sa = (xfs_attr_sf_sort_t *)a;
33 38302351 : sb = (xfs_attr_sf_sort_t *)b;
34 38302351 : if (sa->hash < sb->hash) {
35 : return -1;
36 19180457 : } else if (sa->hash > sb->hash) {
37 : return 1;
38 : } else {
39 227 : return sa->entno - sb->entno;
40 : }
41 : }
42 :
43 : #define XFS_ISRESET_CURSOR(cursor) \
44 : (!((cursor)->initted) && !((cursor)->hashval) && \
45 : !((cursor)->blkno) && !((cursor)->offset))
46 : /*
47 : * Copy out entries of shortform attribute lists for attr_list().
48 : * Shortform attribute lists are not stored in hashval sorted order.
49 : * If the output buffer is not large enough to hold them all, then
50 : * we have to calculate each entries' hashvalue and sort them before
51 : * we can begin returning them to the user.
52 : */
53 : static int
54 495495372 : xfs_attr_shortform_list(
55 : struct xfs_attr_list_context *context)
56 : {
57 495495372 : struct xfs_attrlist_cursor_kern *cursor = &context->cursor;
58 495495372 : struct xfs_inode *dp = context->dp;
59 495495372 : struct xfs_attr_sf_sort *sbuf, *sbp;
60 495495372 : struct xfs_attr_shortform *sf;
61 495495372 : struct xfs_attr_sf_entry *sfe;
62 495495372 : struct xfs_mount *mp;
63 495495372 : int sbsize, nsbuf, count, i;
64 495495372 : int error = 0;
65 :
66 495495372 : ASSERT(context != NULL);
67 495495372 : ASSERT(dp != NULL);
68 495495372 : mp = dp->i_mount;
69 495495372 : sf = (struct xfs_attr_shortform *)dp->i_af.if_u1.if_data;
70 495495372 : ASSERT(sf != NULL);
71 495495372 : if (!sf->hdr.count)
72 : return 0;
73 :
74 498976071 : trace_xfs_attr_list_sf(context);
75 :
76 : /*
77 : * If the buffer is large enough and the cursor is at the start,
78 : * do not bother with sorting since we will return everything in
79 : * one buffer and another call using the cursor won't need to be
80 : * made.
81 : * Note the generous fudge factor of 16 overhead bytes per entry.
82 : * If bufsize is zero then put_listent must be a search function
83 : * and can just scan through what we have.
84 : */
85 499111685 : if (context->bufsize == 0 ||
86 489908978 : (XFS_ISRESET_CURSOR(cursor) &&
87 490123842 : (dp->i_af.if_bytes + sf->hdr.count * 16) < context->bufsize)) {
88 1122721046 : for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
89 634476736 : if (XFS_IS_CORRUPT(context->dp->i_mount,
90 : !xfs_attr_namecheck(mp, sfe->nameval,
91 : sfe->namelen,
92 : sfe->flags))) {
93 11 : xfs_dirattr_mark_sick(context->dp, XFS_ATTR_FORK);
94 11 : return -EFSCORRUPTED;
95 : }
96 632258214 : context->put_listent(context,
97 632258214 : sfe->flags,
98 : sfe->nameval,
99 : (int)sfe->namelen,
100 632258214 : &sfe->nameval[sfe->namelen],
101 632258214 : (int)sfe->valuelen);
102 : /*
103 : * Either search callback finished early or
104 : * didn't fit it all in the buffer after all.
105 : */
106 630166249 : if (context->seen_enough)
107 : break;
108 630166249 : sfe = xfs_attr_sf_nextentry(sfe);
109 : }
110 488244310 : trace_xfs_attr_list_sf_all(context);
111 488244310 : return 0;
112 : }
113 :
114 : /* do no more for a search callback */
115 6556888 : if (context->bufsize == 0)
116 : return 0;
117 :
118 : /*
119 : * It didn't all fit, so we have to sort everything on hashval.
120 : */
121 6556888 : sbsize = sf->hdr.count * sizeof(*sbuf);
122 6556888 : sbp = sbuf = kmem_alloc(sbsize, KM_NOFS);
123 :
124 : /*
125 : * Scan the attribute list for the rest of the entries, storing
126 : * the relevant info from only those that match into a buffer.
127 : */
128 6815625 : nsbuf = 0;
129 31059672 : for (i = 0, sfe = &sf->list[0]; i < sf->hdr.count; i++) {
130 24243983 : if (unlikely(
131 : ((char *)sfe < (char *)sf) ||
132 : ((char *)sfe >= ((char *)sf + dp->i_af.if_bytes)))) {
133 0 : XFS_CORRUPTION_ERROR("xfs_attr_shortform_list",
134 : XFS_ERRLEVEL_LOW,
135 : context->dp->i_mount, sfe,
136 : sizeof(*sfe));
137 0 : kmem_free(sbuf);
138 0 : xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK);
139 0 : return -EFSCORRUPTED;
140 : }
141 :
142 24243983 : sbp->entno = i;
143 24243983 : sbp->hash = xfs_da_hashname(sfe->nameval, sfe->namelen);
144 24244047 : sbp->name = sfe->nameval;
145 24244047 : sbp->namelen = sfe->namelen;
146 : /* These are bytes, and both on-disk, don't endian-flip */
147 24244047 : sbp->value = &sfe->nameval[sfe->namelen],
148 24244047 : sbp->valuelen = sfe->valuelen;
149 24244047 : sbp->flags = sfe->flags;
150 24244047 : sfe = xfs_attr_sf_nextentry(sfe);
151 24244047 : sbp++;
152 24244047 : nsbuf++;
153 : }
154 :
155 : /*
156 : * Sort the entries on hash then entno.
157 : */
158 6815689 : xfs_sort(sbuf, nsbuf, sizeof(*sbuf), xfs_attr_shortform_compare);
159 :
160 : /*
161 : * Re-find our place IN THE SORTED LIST.
162 : */
163 6815655 : count = 0;
164 6815655 : cursor->initted = 1;
165 6815655 : cursor->blkno = 0;
166 6815698 : for (sbp = sbuf, i = 0; i < nsbuf; i++, sbp++) {
167 6815452 : if (sbp->hash == cursor->hashval) {
168 0 : if (cursor->offset == count) {
169 : break;
170 : }
171 0 : count++;
172 6815452 : } else if (sbp->hash > cursor->hashval) {
173 : break;
174 : }
175 : }
176 6815655 : if (i == nsbuf)
177 0 : goto out;
178 :
179 : /*
180 : * Loop putting entries into the user buffer.
181 : */
182 31059362 : for ( ; i < nsbuf; i++, sbp++) {
183 24243619 : if (cursor->hashval != sbp->hash) {
184 24243418 : cursor->hashval = sbp->hash;
185 24243418 : cursor->offset = 0;
186 : }
187 24243619 : if (XFS_IS_CORRUPT(context->dp->i_mount,
188 : !xfs_attr_namecheck(mp, sbp->name,
189 : sbp->namelen,
190 : sbp->flags))) {
191 0 : xfs_dirattr_mark_sick(context->dp, XFS_ATTR_FORK);
192 0 : error = -EFSCORRUPTED;
193 0 : goto out;
194 : }
195 24244146 : context->put_listent(context,
196 24244146 : sbp->flags,
197 : sbp->name,
198 24244146 : sbp->namelen,
199 : sbp->value,
200 24244146 : sbp->valuelen);
201 24243751 : if (context->seen_enough)
202 : break;
203 24243707 : cursor->offset++;
204 : }
205 6815787 : out:
206 6815787 : kmem_free(sbuf);
207 6815787 : return error;
208 : }
209 :
210 : /*
211 : * We didn't find the block & hash mentioned in the cursor state, so
212 : * walk down the attr btree looking for the hash.
213 : */
214 : STATIC int
215 1966023 : xfs_attr_node_list_lookup(
216 : struct xfs_attr_list_context *context,
217 : struct xfs_attrlist_cursor_kern *cursor,
218 : struct xfs_buf **pbp)
219 : {
220 1966023 : struct xfs_da3_icnode_hdr nodehdr;
221 1966023 : struct xfs_da_intnode *node;
222 1966023 : struct xfs_da_node_entry *btree;
223 1966023 : struct xfs_inode *dp = context->dp;
224 1966023 : struct xfs_mount *mp = dp->i_mount;
225 1966023 : struct xfs_trans *tp = context->tp;
226 1966023 : struct xfs_buf *bp;
227 1966023 : xfs_failaddr_t fa;
228 1966023 : int i;
229 1966023 : int error = 0;
230 1966023 : unsigned int expected_level = 0;
231 1966023 : uint16_t magic;
232 :
233 1966023 : ASSERT(*pbp == NULL);
234 1966023 : cursor->blkno = 0;
235 4161509 : for (;;) {
236 4161509 : error = xfs_da3_node_read(tp, dp, cursor->blkno, &bp,
237 : XFS_ATTR_FORK);
238 4161543 : if (error)
239 0 : return error;
240 4161543 : node = bp->b_addr;
241 4161543 : magic = be16_to_cpu(node->hdr.info.magic);
242 4161543 : if (magic == XFS_ATTR_LEAF_MAGIC ||
243 4161543 : magic == XFS_ATTR3_LEAF_MAGIC)
244 : break;
245 2195491 : if (magic != XFS_DA_NODE_MAGIC &&
246 2195491 : magic != XFS_DA3_NODE_MAGIC) {
247 0 : XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp,
248 : node, sizeof(*node));
249 0 : goto out_corruptbuf;
250 : }
251 :
252 2195491 : fa = xfs_da3_node_header_check(bp, dp->i_ino);
253 2195480 : if (fa)
254 0 : goto out_corruptbuf;
255 :
256 2195480 : xfs_da3_node_hdr_from_disk(mp, &nodehdr, node);
257 :
258 : /* Tree taller than we can handle; bail out! */
259 2195478 : if (nodehdr.level >= XFS_DA_NODE_MAXDEPTH)
260 0 : goto out_corruptbuf;
261 :
262 : /* Check the level from the root node. */
263 2195478 : if (cursor->blkno == 0)
264 1964972 : expected_level = nodehdr.level - 1;
265 230506 : else if (expected_level != nodehdr.level)
266 0 : goto out_corruptbuf;
267 : else
268 230506 : expected_level--;
269 :
270 2195478 : btree = nodehdr.btree;
271 2195660 : for (i = 0; i < nodehdr.count; btree++, i++) {
272 2195661 : if (cursor->hashval <= be32_to_cpu(btree->hashval)) {
273 2195479 : cursor->blkno = be32_to_cpu(btree->before);
274 2195479 : trace_xfs_attr_list_node_descend(context,
275 : btree);
276 2195479 : break;
277 : }
278 : }
279 2195470 : xfs_trans_brelse(tp, bp);
280 :
281 2195486 : if (i == nodehdr.count)
282 : return 0;
283 :
284 : /* We can't point back to the root. */
285 2195486 : if (XFS_IS_CORRUPT(mp, cursor->blkno == 0)) {
286 0 : xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK);
287 0 : return -EFSCORRUPTED;
288 : }
289 : }
290 :
291 1966052 : fa = xfs_attr3_leaf_header_check(bp, dp->i_ino);
292 1965986 : if (fa) {
293 0 : __xfs_buf_mark_corrupt(bp, fa);
294 0 : goto out_releasebuf;
295 : }
296 :
297 1965986 : if (expected_level != 0)
298 0 : goto out_corruptbuf;
299 :
300 1965986 : *pbp = bp;
301 1965986 : return 0;
302 :
303 0 : out_corruptbuf:
304 0 : xfs_buf_mark_corrupt(bp);
305 0 : out_releasebuf:
306 0 : xfs_trans_brelse(tp, bp);
307 0 : xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK);
308 0 : return -EFSCORRUPTED;
309 : }
310 :
311 : STATIC int
312 1966123 : xfs_attr_node_list(
313 : struct xfs_attr_list_context *context)
314 : {
315 1966123 : struct xfs_attrlist_cursor_kern *cursor = &context->cursor;
316 1966123 : struct xfs_attr3_icleaf_hdr leafhdr;
317 1966123 : struct xfs_attr_leafblock *leaf;
318 1966123 : struct xfs_da_intnode *node;
319 1966123 : struct xfs_buf *bp;
320 1966123 : struct xfs_inode *dp = context->dp;
321 1966123 : struct xfs_mount *mp = dp->i_mount;
322 1966123 : xfs_failaddr_t fa;
323 1966123 : int error = 0;
324 :
325 1966123 : trace_xfs_attr_node_list(context);
326 :
327 1966118 : cursor->initted = 1;
328 :
329 : /*
330 : * Do all sorts of validation on the passed-in cursor structure.
331 : * If anything is amiss, ignore the cursor and look up the hashval
332 : * starting from the btree root.
333 : */
334 1966118 : bp = NULL;
335 1966118 : if (cursor->blkno > 0) {
336 1078 : error = xfs_da3_node_read(context->tp, dp, cursor->blkno, &bp,
337 : XFS_ATTR_FORK);
338 1078 : if (xfs_metadata_is_sick(error))
339 0 : xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK);
340 1078 : if ((error != 0) && (error != -EFSCORRUPTED))
341 : return error;
342 1078 : if (bp) {
343 1078 : struct xfs_attr_leaf_entry *entries;
344 :
345 1078 : node = bp->b_addr;
346 1078 : switch (be16_to_cpu(node->hdr.info.magic)) {
347 0 : case XFS_DA_NODE_MAGIC:
348 : case XFS_DA3_NODE_MAGIC:
349 0 : trace_xfs_attr_list_wrong_blk(context);
350 0 : fa = xfs_da3_node_header_check(bp,
351 : dp->i_ino);
352 0 : if (fa) {
353 0 : __xfs_buf_mark_corrupt(bp, fa);
354 0 : xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK);
355 : }
356 0 : xfs_trans_brelse(context->tp, bp);
357 0 : bp = NULL;
358 0 : break;
359 1078 : case XFS_ATTR_LEAF_MAGIC:
360 : case XFS_ATTR3_LEAF_MAGIC:
361 1078 : leaf = bp->b_addr;
362 1078 : fa = xfs_attr3_leaf_header_check(bp,
363 : dp->i_ino);
364 1078 : if (fa) {
365 0 : __xfs_buf_mark_corrupt(bp, fa);
366 0 : xfs_trans_brelse(context->tp, bp);
367 0 : xfs_dirattr_mark_sick(dp, XFS_ATTR_FORK);
368 0 : bp = NULL;
369 0 : break;
370 : }
371 1078 : xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo,
372 : &leafhdr, leaf);
373 1078 : entries = xfs_attr3_leaf_entryp(leaf);
374 1078 : if (cursor->hashval > be32_to_cpu(
375 : entries[leafhdr.count - 1].hashval)) {
376 0 : trace_xfs_attr_list_wrong_blk(context);
377 0 : xfs_trans_brelse(context->tp, bp);
378 0 : bp = NULL;
379 1078 : } else if (cursor->hashval <= be32_to_cpu(
380 : entries[0].hashval)) {
381 977 : trace_xfs_attr_list_wrong_blk(context);
382 977 : xfs_trans_brelse(context->tp, bp);
383 977 : bp = NULL;
384 : }
385 : break;
386 0 : default:
387 0 : trace_xfs_attr_list_wrong_blk(context);
388 0 : xfs_trans_brelse(context->tp, bp);
389 0 : bp = NULL;
390 : }
391 : }
392 : }
393 :
394 : /*
395 : * We did not find what we expected given the cursor's contents,
396 : * so we start from the top and work down based on the hash value.
397 : * Note that start of node block is same as start of leaf block.
398 : */
399 1966118 : if (bp == NULL) {
400 1966013 : error = xfs_attr_node_list_lookup(context, cursor, &bp);
401 1966000 : if (error || !bp)
402 : return error;
403 : }
404 1966105 : ASSERT(bp != NULL);
405 :
406 : /*
407 : * Roll upward through the blocks, processing each leaf block in
408 : * order. As long as there is space in the result buffer, keep
409 : * adding the information.
410 : */
411 480618453 : for (;;) {
412 480618453 : leaf = bp->b_addr;
413 480618453 : error = xfs_attr3_leaf_list_int(bp, context);
414 480618563 : if (error)
415 : break;
416 480618563 : xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &leafhdr, leaf);
417 480618620 : if (context->seen_enough || leafhdr.forw == 0)
418 : break;
419 478652482 : cursor->blkno = leafhdr.forw;
420 478652482 : xfs_trans_brelse(context->tp, bp);
421 478652432 : error = xfs_attr3_leaf_read(context->tp, dp, dp->i_ino,
422 : cursor->blkno, &bp);
423 478652348 : if (error)
424 0 : return error;
425 : }
426 1966138 : xfs_trans_brelse(context->tp, bp);
427 1966138 : return error;
428 : }
429 :
430 : /*
431 : * Copy out attribute list entries for attr_list(), for leaf attribute lists.
432 : */
433 : int
434 569395699 : xfs_attr3_leaf_list_int(
435 : struct xfs_buf *bp,
436 : struct xfs_attr_list_context *context)
437 : {
438 569395699 : struct xfs_attrlist_cursor_kern *cursor = &context->cursor;
439 569395699 : struct xfs_attr_leafblock *leaf;
440 569395699 : struct xfs_attr3_icleaf_hdr ichdr;
441 569395699 : struct xfs_attr_leaf_entry *entries;
442 569395699 : struct xfs_attr_leaf_entry *entry;
443 569395699 : int i;
444 569395699 : struct xfs_mount *mp = context->dp->i_mount;
445 :
446 569395699 : trace_xfs_attr_list_leaf(context);
447 :
448 569366267 : leaf = bp->b_addr;
449 569366267 : xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
450 569344539 : entries = xfs_attr3_leaf_entryp(leaf);
451 :
452 569344539 : cursor->initted = 1;
453 :
454 : /*
455 : * Re-find our place in the leaf block if this is a new syscall.
456 : */
457 569344539 : if (context->resynch) {
458 : entry = &entries[0];
459 99848201 : for (i = 0; i < ichdr.count; entry++, i++) {
460 98834892 : if (be32_to_cpu(entry->hashval) == cursor->hashval) {
461 8109188 : if (cursor->offset == context->dupcnt) {
462 1088 : context->dupcnt = 0;
463 1088 : break;
464 : }
465 8108100 : context->dupcnt++;
466 90725704 : } else if (be32_to_cpu(entry->hashval) >
467 : cursor->hashval) {
468 90715215 : context->dupcnt = 0;
469 90715215 : break;
470 : }
471 : }
472 91729612 : if (i == ichdr.count) {
473 1013309 : trace_xfs_attr_list_notfound(context);
474 1013309 : return 0;
475 : }
476 : } else {
477 : entry = &entries[0];
478 : i = 0;
479 : }
480 568331230 : context->resynch = 0;
481 :
482 : /*
483 : * We have found our place, start copying out the new attributes.
484 : */
485 6545717276 : for (; i < ichdr.count; entry++, i++) {
486 5977236821 : char *name;
487 5977236821 : void *value;
488 5977236821 : int namelen, valuelen;
489 :
490 5977236821 : if (be32_to_cpu(entry->hashval) != cursor->hashval) {
491 2217495001 : cursor->hashval = be32_to_cpu(entry->hashval);
492 2217495001 : cursor->offset = 0;
493 : }
494 :
495 5977236821 : if ((entry->flags & XFS_ATTR_INCOMPLETE) &&
496 0 : !context->allow_incomplete)
497 0 : continue;
498 :
499 5977236821 : if (entry->flags & XFS_ATTR_LOCAL) {
500 5977235286 : xfs_attr_leaf_name_local_t *name_loc;
501 :
502 5977235286 : name_loc = xfs_attr3_leaf_name_local(leaf, i);
503 5977235286 : name = name_loc->nameval;
504 5977235286 : namelen = name_loc->namelen;
505 5977235286 : value = &name_loc->nameval[name_loc->namelen];
506 5977235286 : valuelen = be16_to_cpu(name_loc->valuelen);
507 : } else {
508 1535 : xfs_attr_leaf_name_remote_t *name_rmt;
509 :
510 1535 : name_rmt = xfs_attr3_leaf_name_remote(leaf, i);
511 1535 : name = name_rmt->name;
512 1535 : namelen = name_rmt->namelen;
513 1535 : value = NULL;
514 1535 : valuelen = be32_to_cpu(name_rmt->valuelen);
515 : }
516 :
517 5977236821 : if (XFS_IS_CORRUPT(context->dp->i_mount,
518 : !xfs_attr_namecheck(mp, name, namelen,
519 : entry->flags))) {
520 0 : xfs_dirattr_mark_sick(context->dp, XFS_ATTR_FORK);
521 0 : return -EFSCORRUPTED;
522 : }
523 5977111212 : context->put_listent(context, entry->flags,
524 : name, namelen, value, valuelen);
525 5977387200 : if (context->seen_enough)
526 : break;
527 5977386046 : cursor->offset++;
528 : }
529 568481609 : trace_xfs_attr_list_leaf_end(context);
530 568481609 : return 0;
531 : }
532 :
533 : /*
534 : * Copy out attribute entries for attr_list(), for leaf attribute lists.
535 : */
536 : STATIC int
537 88864793 : xfs_attr_leaf_list(
538 : struct xfs_attr_list_context *context)
539 : {
540 88864793 : struct xfs_buf *bp;
541 88864793 : int error;
542 :
543 88864793 : trace_xfs_attr_leaf_list(context);
544 :
545 88799263 : context->cursor.blkno = 0;
546 88799263 : error = xfs_attr3_leaf_read(context->tp, context->dp,
547 88799263 : context->dp->i_ino, 0, &bp);
548 88780342 : if (error)
549 : return error;
550 :
551 88780667 : error = xfs_attr3_leaf_list_int(bp, context);
552 88832681 : xfs_trans_brelse(context->tp, bp);
553 88832681 : return error;
554 : }
555 :
556 : int
557 634137345 : xfs_attr_list_ilocked(
558 : struct xfs_attr_list_context *context)
559 : {
560 634137345 : struct xfs_inode *dp = context->dp;
561 :
562 634137345 : ASSERT(xfs_isilocked(dp, XFS_ILOCK_SHARED | XFS_ILOCK_EXCL));
563 :
564 : /*
565 : * Decide on what work routines to call based on the inode size.
566 : */
567 629748276 : if (!xfs_inode_hasattr(dp))
568 : return 0;
569 586310970 : if (dp->i_af.if_format == XFS_DINODE_FMT_LOCAL)
570 495509472 : return xfs_attr_shortform_list(context);
571 90801498 : if (xfs_attr_is_leaf(dp))
572 88861572 : return xfs_attr_leaf_list(context);
573 1966129 : return xfs_attr_node_list(context);
574 : }
575 :
576 : int
577 633736822 : xfs_attr_list(
578 : struct xfs_attr_list_context *context)
579 : {
580 633736822 : struct xfs_inode *dp = context->dp;
581 633736822 : uint lock_mode;
582 633736822 : int error;
583 :
584 633736822 : XFS_STATS_INC(dp->i_mount, xs_attr_list);
585 :
586 1266878924 : if (xfs_is_shutdown(dp->i_mount))
587 : return -EIO;
588 :
589 633439462 : lock_mode = xfs_ilock_attr_map_shared(dp);
590 633380973 : error = xfs_attr_list_ilocked(context);
591 629894965 : xfs_iunlock(dp, lock_mode);
592 629894965 : return error;
593 : }
|