https://github.com/torvalds/linux
Revision b928095b0a7cff7fb9fcf4c706348ceb8ab2c295 authored by Miklos Szeredi on 24 September 2014, 15:56:17 UTC, committed by Al Viro on 27 September 2014, 01:16:42 UTC
If overwriting an empty directory with rename, then need to drop the extra nlink. Test prog: #include <stdio.h> #include <fcntl.h> #include <err.h> #include <sys/stat.h> int main(void) { const char *test_dir1 = "test-dir1"; const char *test_dir2 = "test-dir2"; int res; int fd; struct stat statbuf; res = mkdir(test_dir1, 0777); if (res == -1) err(1, "mkdir(\"%s\")", test_dir1); res = mkdir(test_dir2, 0777); if (res == -1) err(1, "mkdir(\"%s\")", test_dir2); fd = open(test_dir2, O_RDONLY); if (fd == -1) err(1, "open(\"%s\")", test_dir2); res = rename(test_dir1, test_dir2); if (res == -1) err(1, "rename(\"%s\", \"%s\")", test_dir1, test_dir2); res = fstat(fd, &statbuf); if (res == -1) err(1, "fstat(%i)", fd); if (statbuf.st_nlink != 0) { fprintf(stderr, "nlink is %lu, should be 0\n", statbuf.st_nlink); return 1; } return 0; } Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 0f33be0
Tip revision: b928095b0a7cff7fb9fcf4c706348ceb8ab2c295 authored by Miklos Szeredi on 24 September 2014, 15:56:17 UTC
shmem: fix nlink for rename overwrite directory
shmem: fix nlink for rename overwrite directory
Tip revision: b928095
File | Mode | Size |
---|---|---|
Kconfig | -rw-r--r-- | 2.2 KB |
Makefile | -rw-r--r-- | 1.4 KB |
bat_algo.h | -rw-r--r-- | 805 bytes |
bat_iv_ogm.c | -rw-r--r-- | 59.5 KB |
bitarray.c | -rw-r--r-- | 2.8 KB |
bitarray.h | -rw-r--r-- | 1.7 KB |
bridge_loop_avoidance.c | -rw-r--r-- | 47.3 KB |
bridge_loop_avoidance.h | -rw-r--r-- | 3.0 KB |
debugfs.c | -rw-r--r-- | 13.7 KB |
debugfs.h | -rw-r--r-- | 1.1 KB |
distributed-arp-table.c | -rw-r--r-- | 34.0 KB |
distributed-arp-table.h | -rw-r--r-- | 4.6 KB |
fragmentation.c | -rw-r--r-- | 14.7 KB |
fragmentation.h | -rw-r--r-- | 1.7 KB |
gateway_client.c | -rw-r--r-- | 24.0 KB |
gateway_client.h | -rw-r--r-- | 1.7 KB |
gateway_common.c | -rw-r--r-- | 6.6 KB |
gateway_common.h | -rw-r--r-- | 1.5 KB |
hard-interface.c | -rw-r--r-- | 19.2 KB |
hard-interface.h | -rw-r--r-- | 3.0 KB |
hash.c | -rw-r--r-- | 1.8 KB |
hash.h | -rw-r--r-- | 5.0 KB |
icmp_socket.c | -rw-r--r-- | 10.0 KB |
icmp_socket.h | -rw-r--r-- | 1003 bytes |
main.c | -rw-r--r-- | 35.8 KB |
main.h | -rw-r--r-- | 13.5 KB |
multicast.c | -rw-r--r-- | 23.0 KB |
multicast.h | -rw-r--r-- | 2.1 KB |
network-coding.c | -rw-r--r-- | 57.4 KB |
network-coding.h | -rw-r--r-- | 3.4 KB |
originator.c | -rw-r--r-- | 32.3 KB |
originator.h | -rw-r--r-- | 4.2 KB |
packet.h | -rw-r--r-- | 17.9 KB |
routing.c | -rw-r--r-- | 31.4 KB |
routing.h | -rw-r--r-- | 2.1 KB |
send.c | -rw-r--r-- | 19.7 KB |
send.h | -rw-r--r-- | 3.9 KB |
soft-interface.c | -rw-r--r-- | 30.3 KB |
soft-interface.h | -rw-r--r-- | 1.5 KB |
sysfs.c | -rw-r--r-- | 25.8 KB |
sysfs.h | -rw-r--r-- | 1.9 KB |
translation-table.c | -rw-r--r-- | 111.1 KB |
translation-table.h | -rw-r--r-- | 2.6 KB |
types.h | -rw-r--r-- | 45.9 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...