aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--kernel/file.c12
2 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e4198f9..95d0e2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
2004-07-13 Miklos Szeredi <miklos@szeredi.hu>
* Add FUSE_HARD_REMOVE flag, and '-i' option to fuse main, which
- disable the "hide if open" behavior of unlink/rename.
+ disable the "hide if open" behavior of unlink/rename.
+
+ * If temporary buffer allocation fails in raw read, fall back to a
+ smaller buffer
2004-07-12 Miklos Szeredi <miklos@szeredi.hu>
diff --git a/kernel/file.c b/kernel/file.c
index 215d9b5..8e32f45 100644
--- a/kernel/file.c
+++ b/kernel/file.c
@@ -345,14 +345,20 @@ static ssize_t fuse_read(struct file *file, char *buf, size_t count,
char *tmpbuf;
ssize_t res = 0;
loff_t pos = *ppos;
+ unsigned int max_read = count < fc->max_read ? count : fc->max_read;
- tmpbuf = kmalloc(count < fc->max_read ? count : fc->max_read,
- GFP_KERNEL);
+ do {
+ tmpbuf = kmalloc(max_read, GFP_KERNEL);
+ if (tmpbuf)
+ break;
+
+ max_read /= 2;
+ } while (max_read > PAGE_CACHE_SIZE / 4);
if (!tmpbuf)
return -ENOMEM;
while (count) {
- size_t nbytes = count < fc->max_read ? count : fc->max_read;
+ size_t nbytes = count < max_read ? count : max_read;
ssize_t res1;
res1 = fuse_send_read(inode, tmpbuf, pos, nbytes);
if (res1 < 0) {