aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/ubd_kern.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 4d8b165bfa48..9a56ff94308d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -156,6 +156,7 @@ static struct gendisk *fake_gendisk[MAX_DEV];
156static struct openflags global_openflags = OPEN_FLAGS; 156static struct openflags global_openflags = OPEN_FLAGS;
157 157
158struct cow { 158struct cow {
159 /* This is the backing file, actually */
159 char *file; 160 char *file;
160 int fd; 161 int fd;
161 unsigned long *bitmap; 162 unsigned long *bitmap;
@@ -927,10 +928,14 @@ static int ubd_open(struct inode *inode, struct file *filp)
927 } 928 }
928 } 929 }
929 dev->count++; 930 dev->count++;
930 if((filp->f_mode & FMODE_WRITE) && !dev->openflags.w){ 931 set_disk_ro(disk, !dev->openflags.w);
932
933 /* This should no more be needed. And it didn't work anyway to exclude
934 * read-write remounting of filesystems.*/
935 /*if((filp->f_mode & FMODE_WRITE) && !dev->openflags.w){
931 if(--dev->count == 0) ubd_close(dev); 936 if(--dev->count == 0) ubd_close(dev);
932 err = -EROFS; 937 err = -EROFS;
933 } 938 }*/
934 out: 939 out:
935 return(err); 940 return(err);
936} 941}
@@ -1096,6 +1101,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
1096 1101
1097 if(req->rq_status == RQ_INACTIVE) return(1); 1102 if(req->rq_status == RQ_INACTIVE) return(1);
1098 1103
1104 /* This should be impossible now */
1099 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ 1105 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){
1100 printk("Write attempted on readonly ubd device %s\n", 1106 printk("Write attempted on readonly ubd device %s\n",
1101 disk->disk_name); 1107 disk->disk_name);
@@ -1243,6 +1249,7 @@ static int ubd_check_remapped(int fd, unsigned long address, int is_write,
1243 1249
1244 /* It's a write to a ubd device */ 1250 /* It's a write to a ubd device */
1245 1251
1252 /* This should be impossible now */
1246 if(!dev->openflags.w){ 1253 if(!dev->openflags.w){
1247 /* It's a write access on a read-only device - probably 1254 /* It's a write access on a read-only device - probably
1248 * shouldn't happen. If the kernel is trying to change 1255 * shouldn't happen. If the kernel is trying to change
@@ -1605,8 +1612,7 @@ void do_io(struct io_thread_req *req)
1605 } 1612 }
1606 } while((n < len) && (n != 0)); 1613 } while((n < len) && (n != 0));
1607 if (n < len) memset(&buf[n], 0, len - n); 1614 if (n < len) memset(&buf[n], 0, len - n);
1608 } 1615 } else {
1609 else {
1610 n = os_write_file(req->fds[bit], buf, len); 1616 n = os_write_file(req->fds[bit], buf, len);
1611 if(n != len){ 1617 if(n != len){
1612 printk("do_io - write failed err = %d " 1618 printk("do_io - write failed err = %d "