Bug 450870

Summary: tmpwatch mis-handles -m parameter on NFS shares (causes data loss)
Product: Red Hat Enterprise Linux 5 Reporter: Robert Scheck <redhat-bugzilla>
Component: tmpwatchAssignee: Miloslav Trmač <mitr>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: low    
Version: 5.2CC: robert.scheck
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-06-11 15:19:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robert Scheck 2008-06-11 14:38:55 UTC
Description of problem:
I've two servers, 192.168.1.2 which exports /backup with read-write permissions
into the network and 192.168.1.1 which imports/mounts /backup on local /backup
to put backup files on it. After the backup files were put via NFS onto /backup,
tmpwatch -a -m 7d /backup/<directory> is executed. As per man page, everybody
would expect the files to be deleted after 7 days after last modification date.

In fact the files are already deleted after ~ 6 hours - so tmpwatch mis-handles
the -m parameter on NFS shares which causes unwished massive data loss.

Reproducer for me: /backup/test is on an NFS share - both servers are fully
up2date RHEL 5, have same time zone and are synced via NTP to exactly the same 
time.

[root@intranet test]# date
Wed Jun 11 16:35:38 CEST 2008
[root@intranet test]# 

[root@intranet test]# touch -t 200806111000 test
[root@intranet test]# 

[root@intranet test]# ls -l
total 4
-rw-r--r-- 1 root root 0 Jun 11 10:00 test
[root@intranet test]#

[root@intranet test]# tmpwatch -a -m 7d /backup/test/
[root@intranet test]# 

[root@intranet test]# ls -l
total 4
-rw-r--r-- 1 root root 0 Jun 11 10:00 test
[root@intranet test]# 

[root@intranet test]# touch -t 200806110900 test
[root@intranet test]# 

[root@intranet test]# ls -l
total 4
-rw-r--r-- 1 root root 0 Jun 11 09:00 test
[root@intranet test]#

[root@intranet test]# tmpwatch -a -m 7d /backup/test/
[root@intranet test]# 

[root@intranet test]# ls -l
total 0
[root@intranet test]# 

[root@intranet test]# date
Wed Jun 11 16:36:05 CEST 2008
[root@intranet test]#

OUCH! What the fuck happens here?

Version-Release number of selected component (if applicable):
tmpwatch-2.9.7-1.1.el5.1

How reproducible:
Everytime, see above.

Actual results:
tmpwatch mis-handles -m parameter on NFS shares (causes data loss)

Expected results:
Same behaviour for NFS shares as for local disks without data loss.

Additional info:
Even not fixed in latest tmpwatch-2.9.13-2 from Fedora Rawhide.

Comment 1 Miloslav Trmač 2008-06-11 14:52:36 UTC
Thanks for your report.

The 'd' suffix is supported only in tmpwatch-2.9.8, post-rhel5.  So this appears
to be "only" a missing diagnostic.

Does tmpwatch behave correctly if you specify "168" instead of "7d"?

Comment 2 Robert Scheck 2008-06-11 15:16:41 UTC
You're fully right - sorry, my mistake.

Comment 3 Robert Scheck 2008-06-11 15:17:11 UTC
Please close as NOTABUG, because I'm not allowed to do so for my own bug report.