Re: calcsize locks /dev/null? Why?
Heiko Schlittermann <[email protected]> Sun, 24 Mar 2019 14:30:54 +0100
| Newsgroups | gmane.comp.archivers.amanda.devel |
|---|---|
| Organization | schlittermann -- internet & unix support |
| Message-ID | <[email protected]> |
Dustin J. Mitchell <[email protected]> (So 24 Mär 2019 14:24:40 CET): > It looks like that was changed recently in client-src/calcsize.c > https://github.com/zmanda/amanda/commit/2d5dcfecda760c08f9bff8d812fb45d9d0655fb1#diff-f89593c4478a9846176d4cdcb6b7e43a > > But that commit message is, sadly, totally useless. The amflock(1, > ..) call comes from ancient, pre-git history. So, I have no idea. > One thought might be to look in the users mailing list archives to see > if the commit mentioned above was fixing an error reported there. I built my own patch for testing in my own production environment --- a/client-src/calcsize.c +++ b/client-src/calcsize.c @@ -358,7 +358,14 @@ } for(i = 0; i < ndumps; i++) { - amflock(1, "size"); +#define LOCKFILE "/run/lock/amanda.lck" + int lockfd = open(LOCKFILE, O_WRONLY|O_CREAT, 0666); + if (lockfd == -1) { + error("can not open %s: %m", LOCKFILE); + /*NOTREACHED*/ + } + + amflock(lockfd, "size"); dbprintf("calcsize: %s %d SIZE %lld\n", qamname, dumplevel[i], @@ -368,7 +375,8 @@ (long long)final_size(i, dirname)); fflush(stderr); - amfunlock(1, "size"); + amfunlock(lockfd, "size"); + close(lockfd); } amfree(qamname); -- Heiko
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE0L/WueylaUpvFJ3Or0zGdqa2wUIFAlyXho0ACgkQr0zGdqa2 wUIQVQf+IQASEAN2i68UTemOfBLNqlVClyDsu9jV0JjrcJ2di2OnarJi2xd7Zo3s HpxwoNVahjeb3jL53mwlTUo1lTPQRJry/G7mpZKc7Ixo2VuimlWwpf0yXZmHTrka Rpi2Ssqxaqephv2IwkRVRfWUzv4T9HAAzgCbUFZqCj8rLC0H9lb+iopVOpQBfHO+ mboQlEXDnUaK0+knwkocJbmpiib9EloIVLiltGS9ObsyUaAVoTZm4Vdx3sL2M+Ur ZQrOIozo80Rx1copGrWtndnfK9/6kfEmoZmSr3W/9Qgn3ch4EXgi5lWyevLMuX13 /uP98KsZcbikBBEuj9K2BfKgB5ADAg== =oZse -----END PGP SIGNATURE-----