Bug 749117
| Summary: | extN: new file created even if open(2) returned -EPERM | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Eryu Guan <eguan> | |
| Component: | kernel | Assignee: | Eric Sandeen <esandeen> | |
| Status: | CLOSED ERRATA | QA Contact: | Petr Beňas <pbenas> | |
| Severity: | low | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 6.3 | CC: | dchinner, esandeen, kzhang, lczerner, pbenas, pstehlik, rwheeler | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | All | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | kernel-2.6.32-229.el6 | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 756309 (view as bug list) | Environment: | ||
| Last Closed: | 2012-06-20 08:00:14 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: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 756309, 767187 | |||
This would be an upstream discussion I think. Seems upstream prefers masking out append and immutable bits from EXTN_FL_INHERITED http://permalink.gmane.org/gmane.comp.file-systems.ext4/27277 Upstream now as of commit 1cd9f097 This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release. Patch(es) available on kernel-2.6.32-229.el6 Reproduced in 2.6.32-221.el6.x86_64 and verified in 2.6.32-229.el6.x86_64. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2012-0862.html  | 
Description of problem: In an append only dir, a open(2) call without O_RDONLY and O_APPEND will return -EPERM, but after the call new file is created. Version-Release number of selected component (if applicable): kernel-2.6.32-211.el6 How reproducible: 100% Steps to Reproduce: 1. mkdir /mnt/ext4/append-only 2. chattr +a /mnt/ext4/append-only 3. ./test /mnt/ext4/append-only/testfile (touch /mnt/ext4/append-only/testfile will also work, but touch won't return error, you have to strace touch and search for open, it returns -EPERM) # cat test.c #include <stdio.h> #include <sys/types.h> #include <fcntl.h> #include <sys/stat.h> #include <stdlib.h> #include <errno.h> int main(int argc, char *argv[]) { int fd; fd = open(argv[1], O_RDWR|O_CREAT, 0666); if (fd == -1) perror("open failed"); exit(errno); } Actual results: [root@fstest xfstests]# mkdir -p /mnt/ext4/append-only [root@fstest xfstests]# chattr +a /mnt/ext4/append-only [root@fstest xfstests]# lsattr /mnt/ext4/ --------------- /mnt/ext4/lost+found -----a-------e- /mnt/ext4/append-only [root@fstest xfstests]# ./test /mnt/ext4/append-only/testfile open failed: Operation not permitted [root@fstest xfstests]# ls -l /mnt/ext4/append-only/testfile -rw-r--r--. 1 root root 0 Oct 26 16:07 /mnt/ext4/append-only/testfile [root@fstest xfstests]# lsattr /mnt/ext4/append-only/testfile -----a-------e- /mnt/ext4/append-only/testfile Expected results: open(2) return success or new file is not created at all Additional info: xfs will create new file with no problem btrfs will fail too Not sure if it's really a bug, but some kind of inconsistent