Repository navigation
Commit 21b1a55
virtiofs: accept FSYNCDIR through the synthetic root's handle
fsync and fdatasync of a descriptor of an aggregate's synthetic root,
as `sync` calls for a directory that it is given, failed with EBADF,
which POSIX reserves for a descriptor that is not open
(microsoft/nvx#1624).
The Linux FUSE client sends both as FUSE_FSYNCDIR, with the node of the
directory and the handle that FUSE_OPENDIR returned. FUSE_OPENDIR of
the synthetic root returns SYNTHETIC_ROOT_FH, which names no open file,
and READDIR, READDIRPLUS, and RELEASEDIR, and GETATTR and STATX through
a handle, recognize it with the root's node before they look a handle
up. VirtioFs::fsync_dir looked it up in the handle map, found nothing,
and failed with EBADF.
fsync_dir now succeeds for the synthetic root's handle with the root's
node, as release_dir does, before it looks a handle up: the root keeps
its entries only in memory, so it has nothing to write back. ENOSYS
would not do, since the Linux client takes it for the whole mount and
stops syncing the children's directories too. Any other handle or node
reaches get_file as before.
aggregate::tests::synthetic_root_handle_accepts_fsyncdir checks that
FUSE_FSYNCDIR through an aggregate root's handle succeeds with and
without FUSE_FSYNC_FDATASYNC, and that the handle with a child's node,
and another handle with the root's node, still fail with EBADF. At its
parent, 655bc31, the change for microsoft/nvx#1606 on the stack of
changes above feature/microvm/dev 3288834, the test fails with EBADF
on Windows and on a Linux KVM host; with the fix, it and the rest of
cargo nextest -p virtiofs pass on both.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 655bc31 commit 21b1a55
3 files changed
Lines changed: 88 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
14 | 21 | | |
15 | 22 | | |
16 | 23 | | |
17 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
18 | 41 | | |
19 | 42 | | |
20 | 43 | | |
| |||
112 | 135 | | |
113 | 136 | | |
114 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
115 | 195 | | |
116 | 196 | | |
117 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
| 482 | + | |
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
588 | 593 | | |
589 | 594 | | |
590 | 595 | | |
| |||
0 commit comments