Fix chmod/chown of empty NFS root directory

This commit is contained in:
Vitaliy Filippov
2026-03-03 02:05:37 +03:00
parent c541dd422f
commit 637684c579
2 changed files with 9 additions and 2 deletions
+7 -2
View File
@@ -61,7 +61,7 @@ resume_1:
}
if (st->ientry["type"].string_value() != "file" &&
st->ientry["type"].string_value() != "" &&
!st->set_attrs["size"].is_null())
st->set_attrs.find("size") != st->set_attrs.end())
{
auto cb = std::move(st->cb);
cb(-EINVAL);
@@ -96,8 +96,13 @@ resume_1:
nfs_kv_continue_setattr(st, 2);
}, [st](int res, const std::string & cas_value)
{
if ((res == 0 || res == -ENOENT && st->ino == KV_ROOT_INODE) && cas_value == st->ientry_text)
{
st->cas_res = 0;
return true;
}
st->cas_res = res;
return (res == 0 || res == -ENOENT && st->ino == KV_ROOT_INODE) && cas_value == st->ientry_text;
return false;
});
return;
resume_2:
+2
View File
@@ -15,6 +15,8 @@ sudo mount localhost:/ ./testdata/nfs -o port=2050,mountport=2050,nfsvers=3,soft
MNT=$(pwd)/testdata/nfs
trap "sudo umount -f $MNT"' || true; kill -9 $(jobs -p)' EXIT
chown 1000:1000 ./testdata/nfs
touch ./testdata/nfs/f1
chown 1000:1000 ./testdata/nfs/f1
chmod 600 ./testdata/nfs/f1