pcp
[Top] [All Lists]

Re: [pcp] Collateral damage in non-root changes

To: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Subject: Re: [pcp] Collateral damage in non-root changes
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Wed, 21 Nov 2012 21:45:08 -0500 (EST)
Cc: pcp@xxxxxxxxxxx
In-reply-to: <1353544735.19208.60.camel@xxxxxxxxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Hi Ken,

----- Original Message -----
> ...
> And it is now it looks like this ...
> 
> kenj@bozo:~/src/pcp$ pcp
> Performance Co-Pilot configuration on bozo.localdomain:
> 
>  platform: Linux bozo 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21
>  20:28:43 UTC 2011 x86_64
>  hardware: 6 cpus, 2 disks, 8001MB RAM
>  timezone: EST-11
>      pmcd: Version 3.6.10-1, 6 agents, 1 client
>      pmda: pmcd sample sampledso linux mmv simple
>  pmlogger: primary logger: bozo/20121122.11.27
> kenj@bozo:~/src/pcp$ ls -ld /var/lib/pcp/tmp
> drwxrwxrwt 6 root root 4096 2012-11-22 11:27 /var/lib/pcp/tmp
> kenj@bozo:~/src/pcp$ ls -ld /var/lib/pcp/tmp/*
> drwxrwxrwt 2 root root 4096 2012-11-22 10:54 /var/lib/pcp/tmp/mmv
> drwxrwxrwt 2 root root 4096 2012-11-22 10:54
> /var/lib/pcp/tmp/pmdabash
> drwxrwxrwt 2 root root 4096 2012-11-22 10:54 /var/lib/pcp/tmp/pmie
> drwxrwxrwt 2 root root 4096 2012-11-22 11:27
> /var/lib/pcp/tmp/pmlogger
> kenj@bozo:~/src/pcp$ ls -l /var/lib/pcp/tmp/pmlogger
> total 4
> -rw-r--r-- 1 pcp pcp 79 2012-11-22 11:27 8013
> lrwxrwxrwx 1 pcp pcp 30 2012-11-22 11:27 primary ->
> /var/lib/pcp/tmp/pmlogger/8013
> 
> Aside from the path change (which is expected), note the ownership of
> the files in /var/lib/pcp/tmp/pmlogger is now with pcp.pcp (expected
> also).
> 
> Now check out this oddity ...
> 
> kenj@bozo:~/src/pcp$ cat /var/lib/pcp/tmp/pmlogger/8013
> 4330
> bozo.localdomain
> /var/log/pcp/pmlogger/bozo/20121122.11.27
> pmlogger_check
> kenj@bozo:~/src/pcp$ cat /var/lib/pcp/tmp/pmlogger/primary
> cat: /var/lib/pcp/tmp/pmlogger/primary: Permission denied

That doesn't make sense to me (nor do I see how chown on the
pmlogger directory changes this behaviour) - the permissions
of a symlink are irrelevant - as described here...
http://superuser.com/questions/303040/how-do-file-permissions-apply-to-symlinks

Which suggests its the directory... hmmm... the only thing I
can think of is a kernel issue.  Is it possible that there was
a process holding open the existing /var/lib/pcp/tmp/pmlogger
when the new deb was installed (with super-dh_fixperms powers)
and somehow the in-kernel cached dentry / inode for the earlier
directory is being used for permission checks rather than the
new one?

A reboot would prove it one way or the other, cos for me this
does not happen (have checked two machines now - see below).

> Arrgh ... this breaks the pmlogger control scripts and QA.
> 
> But it gets odder ...
> 
> kenj@bozo:~/src/pcp$ sudo chown pcp.pcp /var/lib/pcp/tmp/pmlogger
> kenj@bozo:~/src/pcp$ cat /var/lib/pcp/tmp/pmlogger/primary
> 4330
> bozo.localdomain
> /var/log/pcp/pmlogger/bozo/20121122.11.27
> pmlogger_check
> 
> I think this is ONLY is a problem for the symlink ... and the only
> fix I
> can see working is the chmod to be done in the packaging.
> 
> Any suggestions?
> 

We need to understand the root cause, the packaging is setting up
the permissions appropriately as far as I can tell.  On my Debian
machine, I see the expected behaviour (this with no intervention
after dpkg installing todays deb's):

nathans@verge:~$ ls -ld /var/lib/pcp/tmp
drwxrwxrwt 6 root root 57 Nov 22 13:26 /var/lib/pcp/tmp/
nathans@verge:~$ ls -ld /var/lib/pcp/tmp/pmlogger
drwxrwxrwt 2 root root 32 Nov 22 13:26 /var/lib/pcp/tmp/pmlogger/
nathans@verge:~$ ls -ld /var/lib/pcp/tmp/pmlogger/*
-rw-r--r-- 1 pcp pcp 82 Nov 22 13:26 /var/lib/pcp/tmp/pmlogger/17640
lrwxrwxrwx 1 pcp pcp 31 Nov 22 13:26 /var/lib/pcp/tmp/pmlogger/primary -> 
/var/lib/pcp/tmp/pmlogger/17640
nathans@verge:~$ cat /var/lib/pcp/tmp/pmlogger/17640
4330
verge.scott.net.au
/var/log/pcp/pmlogger/verge/20121122.13.26
pmlogger_check
nathans@verge:~$ cat /var/lib/pcp/tmp/pmlogger/primary
4330
verge.scott.net.au
/var/log/pcp/pmlogger/verge/20121122.13.26
pmlogger_check
nathans@verge:~$ uname -a
Linux verge 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux
nathans@verge:~$ cat /etc/debian_version 
wheezy/sid

That's on an XFS filesystem.  I have another machine running with an 
ext4 root, RHEL6 and it also displays the correct/expected behaviour.
Is there anything unusual about your /var (or /var/lib or ...?)  Have
you tried turning it off and on again?  (host bozo)

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>