Fix chmod/chown of empty NFS root directory
This commit is contained in:
@@ -61,7 +61,7 @@ resume_1:
|
|||||||
}
|
}
|
||||||
if (st->ientry["type"].string_value() != "file" &&
|
if (st->ientry["type"].string_value() != "file" &&
|
||||||
st->ientry["type"].string_value() != "" &&
|
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);
|
auto cb = std::move(st->cb);
|
||||||
cb(-EINVAL);
|
cb(-EINVAL);
|
||||||
@@ -96,8 +96,13 @@ resume_1:
|
|||||||
nfs_kv_continue_setattr(st, 2);
|
nfs_kv_continue_setattr(st, 2);
|
||||||
}, [st](int res, const std::string & cas_value)
|
}, [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;
|
st->cas_res = res;
|
||||||
return (res == 0 || res == -ENOENT && st->ino == KV_ROOT_INODE) && cas_value == st->ientry_text;
|
return false;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
resume_2:
|
resume_2:
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ sudo mount localhost:/ ./testdata/nfs -o port=2050,mountport=2050,nfsvers=3,soft
|
|||||||
MNT=$(pwd)/testdata/nfs
|
MNT=$(pwd)/testdata/nfs
|
||||||
trap "sudo umount -f $MNT"' || true; kill -9 $(jobs -p)' EXIT
|
trap "sudo umount -f $MNT"' || true; kill -9 $(jobs -p)' EXIT
|
||||||
|
|
||||||
|
chown 1000:1000 ./testdata/nfs
|
||||||
|
|
||||||
touch ./testdata/nfs/f1
|
touch ./testdata/nfs/f1
|
||||||
chown 1000:1000 ./testdata/nfs/f1
|
chown 1000:1000 ./testdata/nfs/f1
|
||||||
chmod 600 ./testdata/nfs/f1
|
chmod 600 ./testdata/nfs/f1
|
||||||
|
|||||||
Reference in New Issue
Block a user