Amanda-Users

Re: planner: could not lock log file

2008-09-11 09:29:57
Subject: Re: planner: could not lock log file
From: John Hein <jhein AT timing DOT com>
To: tashirov AT unido-ichet DOT org
Date: Thu, 11 Sep 2008 07:19:32 -0600
Taalaibek Ashirov wrote at 10:31 +0300 on Sep 11, 2008:
 > On Wed, 2008-09-10 at 09:56 -0600, John Hein wrote:
 > > What happens when you compile and run this (as the backup user)?
 > > 
 > > #include <err.h>
 > > #include <fcntl.h>
 > > #include <stdio.h>
 > > int
 > > main()
 > > {
 > >     struct flock lock;
 > >     int fd = open("/var/log/amanda/dotProject/foo", O_RDWR | O_CREAT);
 > >     if (fd < 0) err(1, "open");
 > > 
 > >     lock.l_type = F_WRLCK;
 > >     lock.l_whence = SEEK_SET;
 > >     int r = fcntl(fd, F_SETLKW, &lock);
 > >     if (r < 0) err(1, "fnctl");
 > >     return 0;
 > > }
 > 
 > Hi John! Thank you for your efforts. I got the same error:
 > 
 > $ ./test
 > test: fnctl: Invalid argument

Then it's an issue with your system somehow, not amanda.

Looking at src/sys/kern/kern_descrip.c, you can get EINVAL is if you
pass in l_type that is not F_RDLCK, F_WRLCK or F_UNLCK.

Try adding the printf below and rebuilding your kernel.  Then run the
above test.  Look for the printf in dmesg (or /var/log/messages if you
are using a default syslog.conf).

Index: kern_descrip.c
===================================================================
RCS file: /base/FreeBSD-CVS/src/sys/kern/kern_descrip.c,v
retrieving revision 1.279.2.15.2.1
diff -u -p -r1.279.2.15.2.1 kern_descrip.c
--- kern_descrip.c      14 Feb 2008 11:46:40 -0000      1.279.2.15.2.1
+++ kern_descrip.c      11 Sep 2008 13:17:25 -0000
@@ -533,6 +533,7 @@ kern_fcntl(struct thread *td, int fd, in
                            flp, F_POSIX);
                        break;
                default:
+printf("invalid l_type: %#x\n", flp->l_type);
                        error = EINVAL;
                        break;
                }