Repository navigation
link fails with EEXIST if hard link with the same name was previously replaced with another file and renamed #4849
Copy link
Copy link
Open
Description
Detailed description
Hello, I am running some tests for different filesystems, including glusterfs. There seems to be a following issue:
- Create 2 empty files:
file1andfile2. - Create hard link for
file2atln1. - Replace
ln1withfile1(usingrename). - Rename
ln1toln2. - Try creating hard link for
file2atln1(again).
Last operation fails with File exists error (EEXIST).
Mount logs:
[2026-09-24 12:32:52.561182 +0000] W [MSGID: 114031] [client-rpc-fops_v2.c:2406:client4_0_link_cbk] 0-fstest-client-0: remote operation failed. [{source=/file2}, {target=/ln1}, {errno=17}, {error=File exists}]
[2026-09-24 12:32:52.561195 +0000] W [fuse-bridge.c:1052:fuse_entry_cbk] 0-glusterfs-fuse: 131: LINK() /ln1 => -1 (File exists)
Brick logs:
[2026-09-24 12:32:52.561125 +0000] W [MSGID: 113093] [posix-entry-ops.c:425:posix_set_gfid2path_xattr] 0-fstest-posix: setting gfid2path xattr failed on /mnt/brick/data/ln1: key = trusted.gfid2path.135a277770d12235 [File exists]
[2026-09-24 12:32:52.561153 +0000] I [MSGID: 115062] [server-rpc-fops_v2.c:1173:server4_link_cbk] 0-fstest-server: LINK info [{frame=121}, {LINK_path=/file2}, {gfid_str=41f55308-cf26-4b1f-995f-7d9d162a649a}, {newpar_str=00000000-0000-0000-0000-000000000001}, {resolve2.bname=ln1}, {client=CTX_ID:44dc291f-c90f-4bc3-b19e-86a159975b98-GRAPH_ID:0-PID:1677-HOST:ubuntu-PC_NAME:fstest-client-0-RECON_NO:-0}, {error-xlator=fstest-posix}, {errno=17}, {error=File exists}]
System info
{
"Hostname" : "ubuntu",
"StaticHostname" : "ubuntu",
"PrettyHostname" : null,
"DefaultHostname" : "localhost",
"HostnameSource" : "static",
"IconName" : "computer-vm",
"Chassis" : "vm",
"ChassisAssetTag" : null,
"Deployment" : null,
"Location" : null,
"KernelName" : "Linux",
"KernelRelease" : "7.0.0-34-generic",
"KernelVersion" : "#34-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 2 14:29:37 UTC 2026",
"OperatingSystemPrettyName" : "Ubuntu 26.04.1 LTS",
"OperatingSystemCPEName" : null,
"OperatingSystemHomeURL" : "https://www.ubuntu.com/",
"OperatingSystemReleaseData" : [
"PRETTY_NAME=Ubuntu 26.04.1 LTS",
"NAME=Ubuntu",
"VERSION_ID=26.04",
"VERSION=26.04.1 LTS (Resolute Raccoon)",
"VERSION_CODENAME=resolute",
"ID=ubuntu",
"ID_LIKE=debian",
"HOME_URL=https://www.ubuntu.com/",
"SUPPORT_URL=https://help.ubuntu.com/",
"BUG_REPORT_URL=https://bugs.launchpad.net/ubuntu/",
"PRIVACY_POLICY_URL=https://www.ubuntu.com/legal/terms-and-policies/privacy-policy",
"UBUNTU_CODENAME=resolute",
"LOGO=ubuntu-logo"
],
}How to reproduce
Tested glusterfs versions: 11.2.
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
int status;
status = creat("file1", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
printf("CREAT: %d\n", status);
close(status);
status = creat("file2", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
printf("CREAT: %d\n", status);
close(status);
status = link("file2", "ln1");
printf("LINK: %d\n", status);
status = rename("file1", "ln1");
printf("RENAME: %d\n", status);
status = rename("ln1", "ln2");
printf("RENAME: %d\n", status);
status = link("file2", "ln1");
printf("LINK: %d (%s)\n", status, strerror(errno));
}
// ::Expected::
// CREAT: 3
// CREAT: 3
// LINK: 0
// RENAME: 0
// RENAME: 0
// LINK: 0 (Success)
// ::Actual::
// CREAT: 3
// CREAT: 3
// LINK: 0
// RENAME: 0
// RENAME: 0
// LINK: -1 (File exists)Steps:
- Start
glusterdservice. - Create and mount 1 XFS filesystems on 1 device.
- Create and start volume.
- Mount volume.
- Compile the script.
- Change directory to volume root.
- Run compiled script.
- Observe that last operation fails.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
Slava0135 commentedon Sep 24, 2026
Here is the test that can be run using GlusterFS framework:
issue-xxxx.t:issue-xxxx.c: