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 |
---|---|---|
netfilter | ||
Kconfig | -rw-r--r-- | 2.0 KB |
Makefile | -rw-r--r-- | 515 bytes |
br.c | -rw-r--r-- | 4.5 KB |
br_device.c | -rw-r--r-- | 9.1 KB |
br_fdb.c | -rw-r--r-- | 23.8 KB |
br_forward.c | -rw-r--r-- | 6.3 KB |
br_if.c | -rw-r--r-- | 12.3 KB |
br_input.c | -rw-r--r-- | 6.1 KB |
br_ioctl.c | -rw-r--r-- | 8.9 KB |
br_mdb.c | -rw-r--r-- | 11.0 KB |
br_multicast.c | -rw-r--r-- | 51.1 KB |
br_netfilter.c | -rw-r--r-- | 28.5 KB |
br_netlink.c | -rw-r--r-- | 12.9 KB |
br_private.h | -rw-r--r-- | 23.1 KB |
br_private_stp.h | -rw-r--r-- | 1.9 KB |
br_stp.c | -rw-r--r-- | 13.0 KB |
br_stp_bpdu.c | -rw-r--r-- | 5.7 KB |
br_stp_if.c | -rw-r--r-- | 7.7 KB |
br_stp_timer.c | -rw-r--r-- | 4.5 KB |
br_sysfs_br.c | -rw-r--r-- | 23.1 KB |
br_sysfs_if.c | -rw-r--r-- | 8.4 KB |
br_vlan.c | -rw-r--r-- | 11.6 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...