mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
DAFS: fssync online requires a partition name argument
fssync-debug online silently fails when run without a partition name. Check for the required partition name on the server side and the client side. Report errors back to the client when the server side fails to pre-attach the volume. Change-Id: I454b202ac83893b1ee54d586a46d891773090a64 Reviewed-on: http://gerrit.openafs.org/5615 Reviewed-by: Derrick Brashear <shadow@dementix.org> Tested-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
87f969f82d
commit
d171a5e059
@ -445,6 +445,10 @@ VolOnline(struct cmd_syndesc * as, void * rock)
|
|||||||
common_prolog(as, &state);
|
common_prolog(as, &state);
|
||||||
common_volop_prolog(as, &state);
|
common_volop_prolog(as, &state);
|
||||||
|
|
||||||
|
if (state.vop->partName==0 || *(state.vop->partName)==0) {
|
||||||
|
fprintf(stderr, "required argument -partition not given\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
do_volop(&state, FSYNC_VOL_ON, NULL);
|
do_volop(&state, FSYNC_VOL_ON, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -674,6 +674,7 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
|
|||||||
Volume * vp;
|
Volume * vp;
|
||||||
Error error;
|
Error error;
|
||||||
|
|
||||||
|
/* Verify the partition name is null terminated. */
|
||||||
if (SYNC_verifyProtocolString(vcom->vop->partName, sizeof(vcom->vop->partName))) {
|
if (SYNC_verifyProtocolString(vcom->vop->partName, sizeof(vcom->vop->partName))) {
|
||||||
res->hdr.reason = SYNC_REASON_MALFORMED_PACKET;
|
res->hdr.reason = SYNC_REASON_MALFORMED_PACKET;
|
||||||
code = SYNC_FAILED;
|
code = SYNC_FAILED;
|
||||||
@ -683,6 +684,13 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
|
|||||||
/* so, we need to attach the volume */
|
/* so, we need to attach the volume */
|
||||||
|
|
||||||
#ifdef AFS_DEMAND_ATTACH_FS
|
#ifdef AFS_DEMAND_ATTACH_FS
|
||||||
|
/* Verify the partition name is not empty. */
|
||||||
|
if (*vcom->vop->partName == 0) {
|
||||||
|
res->hdr.reason = FSYNC_BAD_PART;
|
||||||
|
code = SYNC_FAILED;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* check DAFS permissions */
|
/* check DAFS permissions */
|
||||||
vp = VLookupVolume_r(&error, vcom->vop->volume, NULL);
|
vp = VLookupVolume_r(&error, vcom->vop->volume, NULL);
|
||||||
if (vp &&
|
if (vp &&
|
||||||
@ -763,11 +771,11 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
|
|||||||
V_VOLUPD);
|
V_VOLUPD);
|
||||||
if (vp)
|
if (vp)
|
||||||
VPutVolume_r(vp);
|
VPutVolume_r(vp);
|
||||||
|
#endif /* !AFS_DEMAND_ATTACH_FS */
|
||||||
if (error) {
|
if (error) {
|
||||||
code = SYNC_DENIED;
|
code = SYNC_DENIED;
|
||||||
res->hdr.reason = error;
|
res->hdr.reason = error;
|
||||||
}
|
}
|
||||||
#endif /* !AFS_DEMAND_ATTACH_FS */
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return code;
|
return code;
|
||||||
|
Loading…
Reference in New Issue
Block a user