Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 299375 Details for
Bug 438423
backport patch to RHEL5 have it flip to synchronous writes when there is a write error
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
reproducer program
write-error-test.c (text/plain), 1.95 KB, created by
Jeff Layton
on 2008-03-27 18:19:05 UTC
(
hide
)
Description:
reproducer program
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2008-03-27 18:19:05 UTC
Size:
1.95 KB
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <fcntl.h> >#include <errno.h> >#include <unistd.h> >#include <sys/vfs.h> > >#define BUFSZ 1024 > >/* > * write specified number of kbytes to given filename, and then do a > * fsync to make sure the writes are flushed. Then, try to write 1k > * more and check the return value to make sure it errors out. Should > * be run with a number of kbytes which is more than the amount of > * space on the destination filesystem > */ >int >main(int argc, char **argv) >{ > char *buf; > int fd, bytes, i, err; > ssize_t written; > struct statfs statfsbuf; > > if (argc < 2) { > printf("Usage: %s filename\n", argv[0]); > return 1; > } > > buf = calloc(1, BUFSZ); > if (buf == NULL) { > printf("calloc failed: %d\n", -ENOMEM); > return -ENOMEM; > } > > fd = open(argv[1], O_WRONLY|O_CREAT|O_TRUNC, 0600); > if (fd < 0) { > printf("open failed: %d\n", -errno); > return -errno; > } > > err = fstatfs(fd, &statfsbuf); > if (err < 0) { > printf("fstatfs failed: %d\n", -errno); > return -errno; > } > > /* bytes of space left on fs */ > bytes = statfsbuf.f_bsize * statfsbuf.f_bfree; > > for (i = 0; i < ((bytes/1024) + 1); i++) > write(fd, buf, BUFSZ); > > fsync(fd); > > /* if we've overrun the amount of space, then we should now be > * doing synchronous writes. > */ > written = write(fd, buf, BUFSZ); > if (written < 0) > printf("success: final write returned error!\n"); > else { > printf("failure: final write did not return error!\n"); > return 1; > } > > /* shrink file to slightly less than the amount of space */ > err = ftruncate(fd, bytes - (3 * BUFSZ)); > if (err < 0) { > printf("truncate failed: %d\n", errno); > return 1; > } > > /* this write should succeed */ > write(fd, buf, BUFSZ); > fsync(fd); > > for (i = 0; i < 4; i++) { > written = write(fd, buf, BUFSZ); > if (written < 0) { > printf("failure: write errored out -- should have succeeded!\n"); > return 1; > } > } > printf("success: writes didn't error -- async writes reenabled!\n"); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 438423
:
298747
|
299375
|
299887
|
302444