Commit 413466f
committed
hfsplus: fix generic/020 xfstests failure
The xfstests' test-case generic/020 fails to execute
correctly:
FSTYP -- hfsplus
PLATFORM -- Linux/x86_64 hfsplus-testing-0001 6.15.0-rc4+ #8 SMP PREEMPT_DYNAMIC Thu May 1 16:43:22 PDT 2025
MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/020 _check_generic_filesystem: filesystem on /dev/loop50 is inconsistent
(see xfstests-dev/results//generic/020.full for details)
*** add lots of attributes
*** check
*** MAX_ATTRS attribute(s)
+/mnt/test/attribute_12286: Numerical result out of range
*** -1 attribute(s)
*** remove lots of attributes
...
(Run 'diff -u /xfstests-dev/tests/generic/020.out /xfstests-dev/results//generic/020.out.bad' to see the entire diff)
The generic/020 creates more than 100 xattrs and gives its
the names user.attribute_<number> (for example, user.attribute_101).
As the next step, listxattr() is called with the goal to check
the correctness of xattrs creation. However, it was issue
in hfsplus_listxattr() logic. This method re-uses
the fd.key->attr.key_name.unicode and strbuf buffers in the loop
without re-initialization. As a result, part of the previous
name could still remain in the buffers. For example,
user.attribute_101 could be processed before user.attribute_54.
The issue resulted in formation the name user.attribute_541
instead of user.attribute_54. This patch adds initialization of
fd.key->attr.key_name.unicode and strbuf buffers before
calling hfs_brec_goto() method that prepare next name in
the buffer.
HFS+ logic supports only inline xattrs. Such extended attributes
can store values not bigger than 3802 bytes [1]. This limitation
requires correction of generic/020 logic. Finally, generic/020
can be executed without any issue:
sudo ./check generic/020
FSTYP -- hfsplus
PLATFORM -- Linux/x86_64 hfsplus-testing-0001 6.19.0-rc1+ #44 SMP PREEMPT_DYNAMIC Mon Dec 22 15:39:00 PST 2025
MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/020 31s ... 38s
Ran: generic/020
Passed all 1 tests
[1] https://elixir.bootlin.com/linux/v6.19-rc2/source/include/linux/hfs_common.h#L626
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
cc: Yangtao Li <frank.li@vivo.com>
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20251224002810.1137139-1-slava@dubeyko.com
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>1 parent 9a8c4ad commit 413466f
2 files changed
Lines changed: 70 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
| 121 | + | |
121 | 122 | | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
241 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
242 | 248 | | |
243 | 249 | | |
244 | 250 | | |
| |||
250 | 256 | | |
251 | 257 | | |
252 | 258 | | |
253 | | - | |
| 259 | + | |
| 260 | + | |
254 | 261 | | |
| 262 | + | |
255 | 263 | | |
256 | 264 | | |
257 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
| 349 | + | |
349 | 350 | | |
| 351 | + | |
350 | 352 | | |
351 | 353 | | |
352 | 354 | | |
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
356 | 358 | | |
357 | | - | |
| 359 | + | |
| 360 | + | |
358 | 361 | | |
| 362 | + | |
359 | 363 | | |
360 | 364 | | |
361 | 365 | | |
| |||
392 | 396 | | |
393 | 397 | | |
394 | 398 | | |
395 | | - | |
| 399 | + | |
396 | 400 | | |
397 | | - | |
| 401 | + | |
398 | 402 | | |
399 | 403 | | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
403 | 407 | | |
404 | 408 | | |
405 | | - | |
| 409 | + | |
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
409 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
410 | 416 | | |
411 | 417 | | |
412 | | - | |
| 418 | + | |
413 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
414 | 425 | | |
415 | 426 | | |
416 | 427 | | |
| |||
423 | 434 | | |
424 | 435 | | |
425 | 436 | | |
| 437 | + | |
| 438 | + | |
426 | 439 | | |
427 | 440 | | |
428 | | - | |
429 | | - | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
430 | 448 | | |
431 | 449 | | |
432 | 450 | | |
433 | 451 | | |
434 | 452 | | |
435 | 453 | | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
436 | 457 | | |
437 | 458 | | |
438 | 459 | | |
| |||
579 | 600 | | |
580 | 601 | | |
581 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
582 | 607 | | |
583 | 608 | | |
584 | 609 | | |
| |||
589 | 614 | | |
590 | 615 | | |
591 | 616 | | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
592 | 620 | | |
593 | 621 | | |
594 | 622 | | |
| |||
679 | 707 | | |
680 | 708 | | |
681 | 709 | | |
| 710 | + | |
682 | 711 | | |
683 | 712 | | |
| 713 | + | |
| 714 | + | |
684 | 715 | | |
685 | 716 | | |
686 | 717 | | |
| |||
698 | 729 | | |
699 | 730 | | |
700 | 731 | | |
701 | | - | |
702 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
703 | 735 | | |
704 | 736 | | |
705 | 737 | | |
| |||
746 | 778 | | |
747 | 779 | | |
748 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
749 | 784 | | |
750 | 785 | | |
751 | 786 | | |
752 | 787 | | |
753 | 788 | | |
754 | 789 | | |
755 | 790 | | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
756 | 795 | | |
757 | 796 | | |
758 | 797 | | |
| |||
761 | 800 | | |
762 | 801 | | |
763 | 802 | | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
764 | 806 | | |
765 | 807 | | |
766 | 808 | | |
| |||
773 | 815 | | |
774 | 816 | | |
775 | 817 | | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
776 | 821 | | |
777 | 822 | | |
778 | 823 | | |
| |||
833 | 878 | | |
834 | 879 | | |
835 | 880 | | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
836 | 884 | | |
837 | 885 | | |
838 | 886 | | |
| |||
0 commit comments