pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patch to fix the comments for |ERROR_MORE_DATA|, 2025-03-04
Posted by Anonymous on Tue 4th Mar 2025 12:33
raw | new post

  1. From 01c5bf30401581c0c9eb6ccaee3bc1309b0f689e Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Tue, 4 Mar 2025 12:53:18 +0100
  4. Subject: [PATCH] daemon: Remove comment about Windows issue in
  5.  |query_sparsefile_datasections()|
  6.  
  7. Remove comment about Windows issue in |query_sparsefile_datasections()|,
  8. this was a misinterpretation how the API should work.
  9.  
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12. daemon/fsctl.c | 34 ++++++++++++++--------------------
  13.  1 file changed, 14 insertions(+), 20 deletions(-)
  14.  
  15. diff --git a/daemon/fsctl.c b/daemon/fsctl.c
  16. index bc74363..87937cc 100644
  17. --- a/daemon/fsctl.c
  18. +++ b/daemon/fsctl.c
  19. @@ -178,29 +178,23 @@ int query_sparsefile_datasections(nfs41_open_state *state,
  20.              outbuffer[i].Length.QuadPart = data_size;
  21.          }
  22.          else {
  23. -            error_more_data = true;
  24. -
  25. -            /* Windows bug:
  26. -             * Technically we should continue until we reach
  27. -             * |end_offset| to return the correct size of the
  28. -             * buffer with |DeviceIoControl(...,
  29. -             * FSCTL_QUERY_ALLOCATED_RANGES,...)| ==
  30. -             * |ERROR_MORE_DATA|.
  31. +            /*
  32. +             * Return |ERROR_MORE_DATA| if we reach end of the
  33. +             * caller-supplied record array and still have more
  34. +             * data sections (i.e. no EOF from
  35. +             + |NFS4_CONTENT_HOLE|/|NFS4_CONTENT_DATA| yet).
  36.               *
  37. -             * Unfortunaely Win10 fsutil will then return
  38. -             * random values after the first 64 entries, so the
  39. -             * best we can do for bug-by-bug compatibility is
  40. -             * to do the same: Stop counting here, and
  41. -             * therefore return
  42. -             * |out_maxrecords*sizeof(FILE_ALLOCATED_RANGE_BUFFER)|,
  43. -             * which is exactly the same number of bytes of the
  44. -             * original buffer passed as argument
  45. +             * FIXME: We should also implement |out_maxrecords==0|,
  46. +             * and then return the size for an array to store
  47. +             * all records.
  48. +             * This can still be too small if between the first
  49. +             * FSCTL call (to get the needed size of the array)
  50. +             * and second FSCTL call to enumerate the
  51. +             * |FILE_ALLOCATED_RANGE_BUFFER| someone adds more
  52. +             * data sections.
  53.               */
  54. -#define WINDOWS_FSUTILSPARSEQUERYRANGE_MOREDATA_BUG 1
  55. -
  56. -#ifdef WINDOWS_FSUTILSPARSEQUERYRANGE_MOREDATA_BUG
  57. +            error_more_data = true;
  58.              break;
  59. -#endif /* WINDOWS_FSUTILSPARSEQUERYRANGE_MOREDATA_BUG */
  60.          }
  61.  
  62.          (*res_num_records)++;
  63. --
  64. 2.45.1

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at