kern/167688: fusefs. Incorrect signal handling with direct_io
Zaytsev Artem
a.arepo at gmail.com
Mon May 7 15:50:13 UTC 2012
>Number: 167688
>Category: kern
>Synopsis: fusefs. Incorrect signal handling with direct_io
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon May 07 15:50:12 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Zaytsev Artem
>Release: FreeBSD 9.0
>Organization:
>Environment:
FreeBSD home 9.0-STABLE FreeBSD 9.0-STABLE #1 r233749M: Sat Mar 31 20:44:17 MSK 2012 amd64
fusefs-kmod-0.3.9.p1.20080208_9 Kernel module for fuse
fusefs-libs-2.7.4 FUSE allows filesystem implementation in userspace
>Description:
If while reading a file from fusefs signal is received, then read(2) will return 0 and errno 0 (just like EOF) instead of EINTR.
>How-To-Repeat:
/* --------------------------- fuse.c ------------------------ */
#include <fuse.h>
#include <string.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
int fs_getattr(const char *name, struct stat *st) {
st->st_mode = S_IFREG;
st->st_size = 1;
return 0;
}
int fs_read(const char *name, char *buf, size_t bufSize, off_t off, struct fuse_file_info *fi) {
sleep(10);
return 1;
}
int main(int argc, char **argv) {
struct fuse_operations operations;
memset(&operations, 0, sizeof(operations));
operations.read = fs_read;
operations.getattr = fs_getattr;
return fuse_main(argc, argv, &operations, NULL);
}
/* ----------------------------------------------------------- */
/* ------------------------- reader.c ------------------------ */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
void on_alarm(int s) {
fprintf(stderr, "alarm\n");
}
int main(int argc, char **argv) {
int fd, readed;
char buf[16];
if(argc < 2)
exit(255);
fd = open(argv[1], O_RDONLY);
if(fd < 0) {
perror("open");
exit(errno);
}
/* handler required, SIG_IGN will mask the error */
signal(SIGALRM, on_alarm);
alarm(1);
readed = read(fd, buf, sizeof(buf));
fprintf(stderr, "Readed: %d, errno=%d\n", (int)readed, (int)errno);
return 0;
}
/* ---------------------------------------------------------- */
# cc -o fs -Wall -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 -I/usr/local/include -L/usr/local/lib -pthread -lfuse fuse.c
# cc -o reader -Wall reader.c
# mkdir mnt
# ./fs -o allow_other -o direct_io mnt
# ./reader mnt
<<< sleep for 1 second >>>
alarm
Readed: 0, errno=0
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list