From: bugzilla-daemon@kernel.org
To: linux-ext4@vger.kernel.org
Subject: [Bug 218850] Unexpected failure when write to a file with two file descriptor
Date: Mon, 27 May 2024 07:28:38 +0000 [thread overview]
Message-ID: <bug-218850-13602-w8IOxcHbEX@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-218850-13602@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=218850
--- Comment #2 from Chi (zhangchi_seg@smail.nju.edu.cn) ---
Could you please help me review this report? I am still able to reproduce the
issue with the following test case:
```
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include <dirent.h>
#include <string>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <sys/xattr.h>
#include <sys/mount.h>
#include <sys/statfs.h>
#include <fcntl.h>
#define ALIGN 4096
void* align_alloc(size_t size) {
void *ptr = NULL;
int ret = posix_memalign(&ptr, ALIGN, size);
if (ret) {
printf("align error\n");
exit(1);
}
return ptr;
}
int main()
{
char *buf_15 = (char*)align_alloc(4096*20);
memset(buf_15, 'a', 4096*20);
char *buf_4 = (char*)align_alloc(4096*20);
memset(buf_4, 'a', 4096*20);
mount("/dev/loop0", "/root/mnt", "ext4", 0, "");
creat("/root/mnt/a", S_IRWXG);
link("/root/mnt/a", "/root/mnt/b");
int fd_a = open("/root/mnt/a", O_RDWR);
int fd_b = open("/root/mnt/b", O_RDWR | O_DIRECT);
lseek(fd_a, 100, SEEK_SET);
write(fd_a, buf_15, 9900);
read(fd_b, buf_4, 73728);
int state = write(fd_b, buf_15, 65536);
if (state == -1) {
printf("write failure\n");
}
return 0;
}
```
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
next prev parent reply other threads:[~2024-05-27 7:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-16 15:02 [Bug 218850] New: Unexpected failure when write to a file with two file descriptor bugzilla-daemon
2024-05-16 15:19 ` [Bug 218850] " bugzilla-daemon
2024-05-27 7:28 ` bugzilla-daemon [this message]
2024-05-27 21:14 ` bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-218850-13602-w8IOxcHbEX@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@kernel.org \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.