diff options
54 files changed, 702 insertions, 589 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 6e943135f0e0..8509dad31204 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -121,24 +121,29 @@ osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, | |||
121 | if (reclen > buf->count) | 121 | if (reclen > buf->count) |
122 | return -EINVAL; | 122 | return -EINVAL; |
123 | d_ino = ino; | 123 | d_ino = ino; |
124 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | 124 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { |
125 | buf->error = -EOVERFLOW; | ||
125 | return -EOVERFLOW; | 126 | return -EOVERFLOW; |
127 | } | ||
126 | if (buf->basep) { | 128 | if (buf->basep) { |
127 | if (put_user(offset, buf->basep)) | 129 | if (put_user(offset, buf->basep)) |
128 | return -EFAULT; | 130 | goto Efault; |
129 | buf->basep = NULL; | 131 | buf->basep = NULL; |
130 | } | 132 | } |
131 | dirent = buf->dirent; | 133 | dirent = buf->dirent; |
132 | put_user(d_ino, &dirent->d_ino); | 134 | if (put_user(d_ino, &dirent->d_ino) || |
133 | put_user(namlen, &dirent->d_namlen); | 135 | put_user(namlen, &dirent->d_namlen) || |
134 | put_user(reclen, &dirent->d_reclen); | 136 | put_user(reclen, &dirent->d_reclen) || |
135 | if (copy_to_user(dirent->d_name, name, namlen) || | 137 | copy_to_user(dirent->d_name, name, namlen) || |
136 | put_user(0, dirent->d_name + namlen)) | 138 | put_user(0, dirent->d_name + namlen)) |
137 | return -EFAULT; | 139 | goto Efault; |
138 | dirent = (void __user *)dirent + reclen; | 140 | dirent = (void __user *)dirent + reclen; |
139 | buf->dirent = dirent; | 141 | buf->dirent = dirent; |
140 | buf->count -= reclen; | 142 | buf->count -= reclen; |
141 | return 0; | 143 | return 0; |
144 | Efault: | ||
145 | buf->error = -EFAULT; | ||
146 | return -EFAULT; | ||
142 | } | 147 | } |
143 | 148 | ||
144 | asmlinkage int | 149 | asmlinkage int |
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c index 1263f00dc35d..69ff671498e5 100644 --- a/arch/parisc/hpux/fs.c +++ b/arch/parisc/hpux/fs.c | |||
@@ -84,22 +84,28 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, | |||
84 | if (reclen > buf->count) | 84 | if (reclen > buf->count) |
85 | return -EINVAL; | 85 | return -EINVAL; |
86 | d_ino = ino; | 86 | d_ino = ino; |
87 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | 87 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { |
88 | buf->error = -EOVERFLOW; | ||
88 | return -EOVERFLOW; | 89 | return -EOVERFLOW; |
90 | } | ||
89 | dirent = buf->previous; | 91 | dirent = buf->previous; |
90 | if (dirent) | 92 | if (dirent) |
91 | put_user(offset, &dirent->d_off); | 93 | if (put_user(offset, &dirent->d_off)) |
94 | goto Efault; | ||
92 | dirent = buf->current_dir; | 95 | dirent = buf->current_dir; |
96 | if (put_user(d_ino, &dirent->d_ino) || | ||
97 | put_user(reclen, &dirent->d_reclen) || | ||
98 | put_user(namlen, &dirent->d_namlen) || | ||
99 | copy_to_user(dirent->d_name, name, namlen) || | ||
100 | put_user(0, dirent->d_name + namlen)) | ||
101 | goto Efault; | ||
93 | buf->previous = dirent; | 102 | buf->previous = dirent; |
94 | put_user(d_ino, &dirent->d_ino); | 103 | buf->current_dir = (void __user *)dirent + reclen; |
95 | put_user(reclen, &dirent->d_reclen); | ||
96 | put_user(namlen, &dirent->d_namlen); | ||
97 | copy_to_user(dirent->d_name, name, namlen); | ||
98 | put_user(0, dirent->d_name + namlen); | ||
99 | dirent = (void __user *)dirent + reclen; | ||
100 | buf->current_dir = dirent; | ||
101 | buf->count -= reclen; | 104 | buf->count -= reclen; |
102 | return 0; | 105 | return 0; |
106 | Efault: | ||
107 | buffer->error = -EFAULT; | ||
108 | return -EFAULT; | ||
103 | } | 109 | } |
104 | 110 | ||
105 | #undef NAME_OFFSET | 111 | #undef NAME_OFFSET |
@@ -126,8 +132,10 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned i | |||
126 | error = buf.error; | 132 | error = buf.error; |
127 | lastdirent = buf.previous; | 133 | lastdirent = buf.previous; |
128 | if (lastdirent) { | 134 | if (lastdirent) { |
129 | put_user(file->f_pos, &lastdirent->d_off); | 135 | if (put_user(file->f_pos, &lastdirent->d_off)) |
130 | error = count - buf.count; | 136 | error = -EFAULT; |
137 | else | ||
138 | error = count - buf.count; | ||
131 | } | 139 | } |
132 | 140 | ||
133 | out_putf: | 141 | out_putf: |
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 76c1e60c92f3..607bd67a18ce 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S | |||
@@ -55,7 +55,7 @@ SECTIONS | |||
55 | __start___ex_table = .; | 55 | __start___ex_table = .; |
56 | *(__ex_table) | 56 | *(__ex_table) |
57 | __stop___ex_table = .; | 57 | __stop___ex_table = .; |
58 | } | 58 | } :data |
59 | 59 | ||
60 | .data : { /* Data */ | 60 | .data : { /* Data */ |
61 | DATA_DATA | 61 | DATA_DATA |
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 6668e6037af6..9592889a6fd0 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile | |||
@@ -52,20 +52,24 @@ endif | |||
52 | export INIT_Y CORE_Y DRIVERS_Y NET_Y LIBS_Y HEAD_Y kallsyms.o | 52 | export INIT_Y CORE_Y DRIVERS_Y NET_Y LIBS_Y HEAD_Y kallsyms.o |
53 | 53 | ||
54 | # Default target | 54 | # Default target |
55 | all: image | 55 | all: zImage |
56 | 56 | ||
57 | boot := arch/sparc/boot | 57 | boot := arch/sparc/boot |
58 | 58 | ||
59 | image tftpboot.img: vmlinux | 59 | image zImage tftpboot.img: vmlinux |
60 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | 60 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
61 | 61 | ||
62 | archclean: | 62 | archclean: |
63 | $(Q)$(MAKE) $(clean)=$(boot) | 63 | $(Q)$(MAKE) $(clean)=$(boot) |
64 | 64 | ||
65 | # This is the image used for packaging | ||
66 | KBUILD_IMAGE := $(boot)/zImage | ||
67 | |||
65 | CLEAN_FILES += arch/$(ARCH)/boot/System.map | 68 | CLEAN_FILES += arch/$(ARCH)/boot/System.map |
66 | 69 | ||
67 | # Don't use tabs in echo arguments. | 70 | # Don't use tabs in echo arguments. |
68 | define archhelp | 71 | define archhelp |
69 | echo '* image - kernel image ($(boot)/image)' | 72 | echo '* image - kernel image ($(boot)/image)' |
73 | echo '* zImage - stripped kernel image ($(boot)/zImage)' | ||
70 | echo ' tftpboot.img - image prepared for tftp' | 74 | echo ' tftpboot.img - image prepared for tftp' |
71 | endef | 75 | endef |
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile index 22d331e1e941..3e77a9f52248 100644 --- a/arch/sparc/boot/Makefile +++ b/arch/sparc/boot/Makefile | |||
@@ -19,6 +19,9 @@ quiet_cmd_sysmap = SYSMAP $(obj)/System.map | |||
19 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap | 19 | cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap |
20 | quiet_cmd_image = LD $@ | 20 | quiet_cmd_image = LD $@ |
21 | cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@ | 21 | cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@ |
22 | quiet_cmd_strip = STRIP $@ | ||
23 | cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $(obj)/image -o $@ | ||
24 | |||
22 | 25 | ||
23 | define rule_image | 26 | define rule_image |
24 | $(if $($(quiet)cmd_image), \ | 27 | $(if $($(quiet)cmd_image), \ |
@@ -49,6 +52,9 @@ LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \ | |||
49 | $(obj)/image: $(obj)/btfix.o FORCE | 52 | $(obj)/image: $(obj)/btfix.o FORCE |
50 | $(call if_changed_rule,image) | 53 | $(call if_changed_rule,image) |
51 | 54 | ||
55 | $(obj)/zImage: $(obj)/image | ||
56 | $(call if_changed,strip) | ||
57 | |||
52 | $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE | 58 | $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE |
53 | $(call if_changed,elftoaout) | 59 | $(call if_changed,elftoaout) |
54 | $(call if_changed,piggy) | 60 | $(call if_changed,piggy) |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 923a98959fa7..36b4b7ab9cfb 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -231,6 +231,7 @@ endmenu | |||
231 | 231 | ||
232 | config NUMA | 232 | config NUMA |
233 | bool "NUMA support" | 233 | bool "NUMA support" |
234 | depends on SMP | ||
234 | 235 | ||
235 | config NODES_SHIFT | 236 | config NODES_SHIFT |
236 | int | 237 | int |
diff --git a/block/blk-core.c b/block/blk-core.c index 4889eb86a39e..2cba5ef97b2b 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -582,6 +582,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) | |||
582 | 582 | ||
583 | q->sg_reserved_size = INT_MAX; | 583 | q->sg_reserved_size = INT_MAX; |
584 | 584 | ||
585 | blk_set_cmd_filter_defaults(&q->cmd_filter); | ||
586 | |||
585 | /* | 587 | /* |
586 | * all done | 588 | * all done |
587 | */ | 589 | */ |
diff --git a/block/blk-tag.c b/block/blk-tag.c index 32667beb03ee..ed5166fbc599 100644 --- a/block/blk-tag.c +++ b/block/blk-tag.c | |||
@@ -38,7 +38,8 @@ static int __blk_free_tags(struct blk_queue_tag *bqt) | |||
38 | 38 | ||
39 | retval = atomic_dec_and_test(&bqt->refcnt); | 39 | retval = atomic_dec_and_test(&bqt->refcnt); |
40 | if (retval) { | 40 | if (retval) { |
41 | BUG_ON(bqt->busy); | 41 | BUG_ON(find_first_bit(bqt->tag_map, bqt->max_depth) < |
42 | bqt->max_depth); | ||
42 | 43 | ||
43 | kfree(bqt->tag_index); | 44 | kfree(bqt->tag_index); |
44 | bqt->tag_index = NULL; | 45 | bqt->tag_index = NULL; |
@@ -147,7 +148,6 @@ static struct blk_queue_tag *__blk_queue_init_tags(struct request_queue *q, | |||
147 | if (init_tag_map(q, tags, depth)) | 148 | if (init_tag_map(q, tags, depth)) |
148 | goto fail; | 149 | goto fail; |
149 | 150 | ||
150 | tags->busy = 0; | ||
151 | atomic_set(&tags->refcnt, 1); | 151 | atomic_set(&tags->refcnt, 1); |
152 | return tags; | 152 | return tags; |
153 | fail: | 153 | fail: |
@@ -313,7 +313,6 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq) | |||
313 | * unlock memory barrier semantics. | 313 | * unlock memory barrier semantics. |
314 | */ | 314 | */ |
315 | clear_bit_unlock(tag, bqt->tag_map); | 315 | clear_bit_unlock(tag, bqt->tag_map); |
316 | bqt->busy--; | ||
317 | } | 316 | } |
318 | EXPORT_SYMBOL(blk_queue_end_tag); | 317 | EXPORT_SYMBOL(blk_queue_end_tag); |
319 | 318 | ||
@@ -368,7 +367,6 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq) | |||
368 | bqt->tag_index[tag] = rq; | 367 | bqt->tag_index[tag] = rq; |
369 | blkdev_dequeue_request(rq); | 368 | blkdev_dequeue_request(rq); |
370 | list_add(&rq->queuelist, &q->tag_busy_list); | 369 | list_add(&rq->queuelist, &q->tag_busy_list); |
371 | bqt->busy++; | ||
372 | return 0; | 370 | return 0; |
373 | } | 371 | } |
374 | EXPORT_SYMBOL(blk_queue_start_tag); | 372 | EXPORT_SYMBOL(blk_queue_start_tag); |
diff --git a/block/bsg.c b/block/bsg.c index 5a68b09a69ba..0aae8d7ba99c 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -45,8 +45,6 @@ struct bsg_device { | |||
45 | char name[BUS_ID_SIZE]; | 45 | char name[BUS_ID_SIZE]; |
46 | int max_queue; | 46 | int max_queue; |
47 | unsigned long flags; | 47 | unsigned long flags; |
48 | struct blk_scsi_cmd_filter *cmd_filter; | ||
49 | mode_t *f_mode; | ||
50 | }; | 48 | }; |
51 | 49 | ||
52 | enum { | 50 | enum { |
@@ -174,7 +172,8 @@ unlock: | |||
174 | } | 172 | } |
175 | 173 | ||
176 | static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, | 174 | static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, |
177 | struct sg_io_v4 *hdr, struct bsg_device *bd) | 175 | struct sg_io_v4 *hdr, struct bsg_device *bd, |
176 | int has_write_perm) | ||
178 | { | 177 | { |
179 | if (hdr->request_len > BLK_MAX_CDB) { | 178 | if (hdr->request_len > BLK_MAX_CDB) { |
180 | rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL); | 179 | rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL); |
@@ -187,8 +186,7 @@ static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq, | |||
187 | return -EFAULT; | 186 | return -EFAULT; |
188 | 187 | ||
189 | if (hdr->subprotocol == BSG_SUB_PROTOCOL_SCSI_CMD) { | 188 | if (hdr->subprotocol == BSG_SUB_PROTOCOL_SCSI_CMD) { |
190 | if (blk_cmd_filter_verify_command(bd->cmd_filter, rq->cmd, | 189 | if (blk_verify_command(&q->cmd_filter, rq->cmd, has_write_perm)) |
191 | bd->f_mode)) | ||
192 | return -EPERM; | 190 | return -EPERM; |
193 | } else if (!capable(CAP_SYS_RAWIO)) | 191 | } else if (!capable(CAP_SYS_RAWIO)) |
194 | return -EPERM; | 192 | return -EPERM; |
@@ -244,7 +242,7 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw) | |||
244 | * map sg_io_v4 to a request. | 242 | * map sg_io_v4 to a request. |
245 | */ | 243 | */ |
246 | static struct request * | 244 | static struct request * |
247 | bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr) | 245 | bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, int has_write_perm) |
248 | { | 246 | { |
249 | struct request_queue *q = bd->queue; | 247 | struct request_queue *q = bd->queue; |
250 | struct request *rq, *next_rq = NULL; | 248 | struct request *rq, *next_rq = NULL; |
@@ -266,7 +264,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr) | |||
266 | rq = blk_get_request(q, rw, GFP_KERNEL); | 264 | rq = blk_get_request(q, rw, GFP_KERNEL); |
267 | if (!rq) | 265 | if (!rq) |
268 | return ERR_PTR(-ENOMEM); | 266 | return ERR_PTR(-ENOMEM); |
269 | ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd); | 267 | ret = blk_fill_sgv4_hdr_rq(q, rq, hdr, bd, has_write_perm); |
270 | if (ret) | 268 | if (ret) |
271 | goto out; | 269 | goto out; |
272 | 270 | ||
@@ -568,25 +566,6 @@ static inline void bsg_set_block(struct bsg_device *bd, struct file *file) | |||
568 | set_bit(BSG_F_BLOCK, &bd->flags); | 566 | set_bit(BSG_F_BLOCK, &bd->flags); |
569 | } | 567 | } |
570 | 568 | ||
571 | static void bsg_set_cmd_filter(struct bsg_device *bd, | ||
572 | struct file *file) | ||
573 | { | ||
574 | struct inode *inode; | ||
575 | struct gendisk *disk; | ||
576 | |||
577 | if (!file) | ||
578 | return; | ||
579 | |||
580 | inode = file->f_dentry->d_inode; | ||
581 | if (!inode) | ||
582 | return; | ||
583 | |||
584 | disk = inode->i_bdev->bd_disk; | ||
585 | |||
586 | bd->cmd_filter = &disk->cmd_filter; | ||
587 | bd->f_mode = &file->f_mode; | ||
588 | } | ||
589 | |||
590 | /* | 569 | /* |
591 | * Check if the error is a "real" error that we should return. | 570 | * Check if the error is a "real" error that we should return. |
592 | */ | 571 | */ |
@@ -608,7 +587,6 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
608 | dprintk("%s: read %Zd bytes\n", bd->name, count); | 587 | dprintk("%s: read %Zd bytes\n", bd->name, count); |
609 | 588 | ||
610 | bsg_set_block(bd, file); | 589 | bsg_set_block(bd, file); |
611 | bsg_set_cmd_filter(bd, file); | ||
612 | 590 | ||
613 | bytes_read = 0; | 591 | bytes_read = 0; |
614 | ret = __bsg_read(buf, count, bd, NULL, &bytes_read); | 592 | ret = __bsg_read(buf, count, bd, NULL, &bytes_read); |
@@ -621,7 +599,7 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
621 | } | 599 | } |
622 | 600 | ||
623 | static int __bsg_write(struct bsg_device *bd, const char __user *buf, | 601 | static int __bsg_write(struct bsg_device *bd, const char __user *buf, |
624 | size_t count, ssize_t *bytes_written) | 602 | size_t count, ssize_t *bytes_written, int has_write_perm) |
625 | { | 603 | { |
626 | struct bsg_command *bc; | 604 | struct bsg_command *bc; |
627 | struct request *rq; | 605 | struct request *rq; |
@@ -652,7 +630,7 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf, | |||
652 | /* | 630 | /* |
653 | * get a request, fill in the blanks, and add to request queue | 631 | * get a request, fill in the blanks, and add to request queue |
654 | */ | 632 | */ |
655 | rq = bsg_map_hdr(bd, &bc->hdr); | 633 | rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm); |
656 | if (IS_ERR(rq)) { | 634 | if (IS_ERR(rq)) { |
657 | ret = PTR_ERR(rq); | 635 | ret = PTR_ERR(rq); |
658 | rq = NULL; | 636 | rq = NULL; |
@@ -683,10 +661,11 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
683 | dprintk("%s: write %Zd bytes\n", bd->name, count); | 661 | dprintk("%s: write %Zd bytes\n", bd->name, count); |
684 | 662 | ||
685 | bsg_set_block(bd, file); | 663 | bsg_set_block(bd, file); |
686 | bsg_set_cmd_filter(bd, file); | ||
687 | 664 | ||
688 | bytes_written = 0; | 665 | bytes_written = 0; |
689 | ret = __bsg_write(bd, buf, count, &bytes_written); | 666 | ret = __bsg_write(bd, buf, count, &bytes_written, |
667 | file->f_mode & FMODE_WRITE); | ||
668 | |||
690 | *ppos = bytes_written; | 669 | *ppos = bytes_written; |
691 | 670 | ||
692 | /* | 671 | /* |
@@ -792,7 +771,6 @@ static struct bsg_device *bsg_add_device(struct inode *inode, | |||
792 | bd->queue = rq; | 771 | bd->queue = rq; |
793 | 772 | ||
794 | bsg_set_block(bd, file); | 773 | bsg_set_block(bd, file); |
795 | bsg_set_cmd_filter(bd, file); | ||
796 | 774 | ||
797 | atomic_set(&bd->ref_count, 1); | 775 | atomic_set(&bd->ref_count, 1); |
798 | mutex_lock(&bsg_mutex); | 776 | mutex_lock(&bsg_mutex); |
@@ -943,7 +921,7 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
943 | if (copy_from_user(&hdr, uarg, sizeof(hdr))) | 921 | if (copy_from_user(&hdr, uarg, sizeof(hdr))) |
944 | return -EFAULT; | 922 | return -EFAULT; |
945 | 923 | ||
946 | rq = bsg_map_hdr(bd, &hdr); | 924 | rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE); |
947 | if (IS_ERR(rq)) | 925 | if (IS_ERR(rq)) |
948 | return PTR_ERR(rq); | 926 | return PTR_ERR(rq); |
949 | 927 | ||
diff --git a/block/cmd-filter.c b/block/cmd-filter.c index eec4404fd357..1d4026206ac2 100644 --- a/block/cmd-filter.c +++ b/block/cmd-filter.c | |||
@@ -20,15 +20,14 @@ | |||
20 | #include <linux/list.h> | 20 | #include <linux/list.h> |
21 | #include <linux/genhd.h> | 21 | #include <linux/genhd.h> |
22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
23 | #include <linux/parser.h> | ||
24 | #include <linux/capability.h> | 23 | #include <linux/capability.h> |
25 | #include <linux/bitops.h> | 24 | #include <linux/bitops.h> |
26 | 25 | ||
27 | #include <scsi/scsi.h> | 26 | #include <scsi/scsi.h> |
28 | #include <linux/cdrom.h> | 27 | #include <linux/cdrom.h> |
29 | 28 | ||
30 | int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter, | 29 | int blk_verify_command(struct blk_cmd_filter *filter, |
31 | unsigned char *cmd, mode_t *f_mode) | 30 | unsigned char *cmd, int has_write_perm) |
32 | { | 31 | { |
33 | /* root can do any command. */ | 32 | /* root can do any command. */ |
34 | if (capable(CAP_SYS_RAWIO)) | 33 | if (capable(CAP_SYS_RAWIO)) |
@@ -43,34 +42,15 @@ int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter, | |||
43 | return 0; | 42 | return 0; |
44 | 43 | ||
45 | /* Write-safe commands require a writable open */ | 44 | /* Write-safe commands require a writable open */ |
46 | if (test_bit(cmd[0], filter->write_ok) && (*f_mode & FMODE_WRITE)) | 45 | if (test_bit(cmd[0], filter->write_ok) && has_write_perm) |
47 | return 0; | 46 | return 0; |
48 | 47 | ||
49 | return -EPERM; | 48 | return -EPERM; |
50 | } | 49 | } |
51 | EXPORT_SYMBOL(blk_cmd_filter_verify_command); | ||
52 | |||
53 | int blk_verify_command(struct file *file, unsigned char *cmd) | ||
54 | { | ||
55 | struct gendisk *disk; | ||
56 | struct inode *inode; | ||
57 | |||
58 | if (!file) | ||
59 | return -EINVAL; | ||
60 | |||
61 | inode = file->f_dentry->d_inode; | ||
62 | if (!inode) | ||
63 | return -EINVAL; | ||
64 | |||
65 | disk = inode->i_bdev->bd_disk; | ||
66 | |||
67 | return blk_cmd_filter_verify_command(&disk->cmd_filter, | ||
68 | cmd, &file->f_mode); | ||
69 | } | ||
70 | EXPORT_SYMBOL(blk_verify_command); | 50 | EXPORT_SYMBOL(blk_verify_command); |
71 | 51 | ||
72 | /* and now, the sysfs stuff */ | 52 | /* and now, the sysfs stuff */ |
73 | static ssize_t rcf_cmds_show(struct blk_scsi_cmd_filter *filter, char *page, | 53 | static ssize_t rcf_cmds_show(struct blk_cmd_filter *filter, char *page, |
74 | int rw) | 54 | int rw) |
75 | { | 55 | { |
76 | char *npage = page; | 56 | char *npage = page; |
@@ -84,8 +64,7 @@ static ssize_t rcf_cmds_show(struct blk_scsi_cmd_filter *filter, char *page, | |||
84 | 64 | ||
85 | for (i = 0; i < BLK_SCSI_MAX_CMDS; i++) { | 65 | for (i = 0; i < BLK_SCSI_MAX_CMDS; i++) { |
86 | if (test_bit(i, okbits)) { | 66 | if (test_bit(i, okbits)) { |
87 | sprintf(npage, "%02x", i); | 67 | npage += sprintf(npage, "0x%02x", i); |
88 | npage += 2; | ||
89 | if (i < BLK_SCSI_MAX_CMDS - 1) | 68 | if (i < BLK_SCSI_MAX_CMDS - 1) |
90 | sprintf(npage++, " "); | 69 | sprintf(npage++, " "); |
91 | } | 70 | } |
@@ -97,57 +76,65 @@ static ssize_t rcf_cmds_show(struct blk_scsi_cmd_filter *filter, char *page, | |||
97 | return npage - page; | 76 | return npage - page; |
98 | } | 77 | } |
99 | 78 | ||
100 | static ssize_t rcf_readcmds_show(struct blk_scsi_cmd_filter *filter, char *page) | 79 | static ssize_t rcf_readcmds_show(struct blk_cmd_filter *filter, char *page) |
101 | { | 80 | { |
102 | return rcf_cmds_show(filter, page, READ); | 81 | return rcf_cmds_show(filter, page, READ); |
103 | } | 82 | } |
104 | 83 | ||
105 | static ssize_t rcf_writecmds_show(struct blk_scsi_cmd_filter *filter, | 84 | static ssize_t rcf_writecmds_show(struct blk_cmd_filter *filter, |
106 | char *page) | 85 | char *page) |
107 | { | 86 | { |
108 | return rcf_cmds_show(filter, page, WRITE); | 87 | return rcf_cmds_show(filter, page, WRITE); |
109 | } | 88 | } |
110 | 89 | ||
111 | static ssize_t rcf_cmds_store(struct blk_scsi_cmd_filter *filter, | 90 | static ssize_t rcf_cmds_store(struct blk_cmd_filter *filter, |
112 | const char *page, size_t count, int rw) | 91 | const char *page, size_t count, int rw) |
113 | { | 92 | { |
114 | ssize_t ret = 0; | ||
115 | unsigned long okbits[BLK_SCSI_CMD_PER_LONG], *target_okbits; | 93 | unsigned long okbits[BLK_SCSI_CMD_PER_LONG], *target_okbits; |
116 | int cmd, status, len; | 94 | int cmd, set; |
117 | substring_t ss; | 95 | char *p, *status; |
118 | 96 | ||
119 | memset(&okbits, 0, sizeof(okbits)); | 97 | if (rw == READ) { |
120 | 98 | memcpy(&okbits, filter->read_ok, sizeof(okbits)); | |
121 | for (len = strlen(page); len > 0; len -= 3) { | 99 | target_okbits = filter->read_ok; |
122 | if (len < 2) | 100 | } else { |
123 | break; | 101 | memcpy(&okbits, filter->write_ok, sizeof(okbits)); |
124 | ss.from = (char *) page + ret; | 102 | target_okbits = filter->write_ok; |
125 | ss.to = (char *) page + ret + 2; | 103 | } |
126 | ret += 3; | 104 | |
127 | status = match_hex(&ss, &cmd); | 105 | while ((p = strsep((char **)&page, " ")) != NULL) { |
106 | set = 1; | ||
107 | |||
108 | if (p[0] == '+') { | ||
109 | p++; | ||
110 | } else if (p[0] == '-') { | ||
111 | set = 0; | ||
112 | p++; | ||
113 | } | ||
114 | |||
115 | cmd = simple_strtol(p, &status, 16); | ||
116 | |||
128 | /* either of these cases means invalid input, so do nothing. */ | 117 | /* either of these cases means invalid input, so do nothing. */ |
129 | if (status || cmd >= BLK_SCSI_MAX_CMDS) | 118 | if ((status == p) || cmd >= BLK_SCSI_MAX_CMDS) |
130 | return -EINVAL; | 119 | return -EINVAL; |
131 | 120 | ||
132 | __set_bit(cmd, okbits); | 121 | if (set) |
122 | __set_bit(cmd, okbits); | ||
123 | else | ||
124 | __clear_bit(cmd, okbits); | ||
133 | } | 125 | } |
134 | 126 | ||
135 | if (rw == READ) | 127 | memcpy(target_okbits, okbits, sizeof(okbits)); |
136 | target_okbits = filter->read_ok; | ||
137 | else | ||
138 | target_okbits = filter->write_ok; | ||
139 | |||
140 | memmove(target_okbits, okbits, sizeof(okbits)); | ||
141 | return count; | 128 | return count; |
142 | } | 129 | } |
143 | 130 | ||
144 | static ssize_t rcf_readcmds_store(struct blk_scsi_cmd_filter *filter, | 131 | static ssize_t rcf_readcmds_store(struct blk_cmd_filter *filter, |
145 | const char *page, size_t count) | 132 | const char *page, size_t count) |
146 | { | 133 | { |
147 | return rcf_cmds_store(filter, page, count, READ); | 134 | return rcf_cmds_store(filter, page, count, READ); |
148 | } | 135 | } |
149 | 136 | ||
150 | static ssize_t rcf_writecmds_store(struct blk_scsi_cmd_filter *filter, | 137 | static ssize_t rcf_writecmds_store(struct blk_cmd_filter *filter, |
151 | const char *page, size_t count) | 138 | const char *page, size_t count) |
152 | { | 139 | { |
153 | return rcf_cmds_store(filter, page, count, WRITE); | 140 | return rcf_cmds_store(filter, page, count, WRITE); |
@@ -155,8 +142,8 @@ static ssize_t rcf_writecmds_store(struct blk_scsi_cmd_filter *filter, | |||
155 | 142 | ||
156 | struct rcf_sysfs_entry { | 143 | struct rcf_sysfs_entry { |
157 | struct attribute attr; | 144 | struct attribute attr; |
158 | ssize_t (*show)(struct blk_scsi_cmd_filter *, char *); | 145 | ssize_t (*show)(struct blk_cmd_filter *, char *); |
159 | ssize_t (*store)(struct blk_scsi_cmd_filter *, const char *, size_t); | 146 | ssize_t (*store)(struct blk_cmd_filter *, const char *, size_t); |
160 | }; | 147 | }; |
161 | 148 | ||
162 | static struct rcf_sysfs_entry rcf_readcmds_entry = { | 149 | static struct rcf_sysfs_entry rcf_readcmds_entry = { |
@@ -183,9 +170,9 @@ static ssize_t | |||
183 | rcf_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | 170 | rcf_attr_show(struct kobject *kobj, struct attribute *attr, char *page) |
184 | { | 171 | { |
185 | struct rcf_sysfs_entry *entry = to_rcf(attr); | 172 | struct rcf_sysfs_entry *entry = to_rcf(attr); |
186 | struct blk_scsi_cmd_filter *filter; | 173 | struct blk_cmd_filter *filter; |
187 | 174 | ||
188 | filter = container_of(kobj, struct blk_scsi_cmd_filter, kobj); | 175 | filter = container_of(kobj, struct blk_cmd_filter, kobj); |
189 | if (entry->show) | 176 | if (entry->show) |
190 | return entry->show(filter, page); | 177 | return entry->show(filter, page); |
191 | 178 | ||
@@ -197,7 +184,7 @@ rcf_attr_store(struct kobject *kobj, struct attribute *attr, | |||
197 | const char *page, size_t length) | 184 | const char *page, size_t length) |
198 | { | 185 | { |
199 | struct rcf_sysfs_entry *entry = to_rcf(attr); | 186 | struct rcf_sysfs_entry *entry = to_rcf(attr); |
200 | struct blk_scsi_cmd_filter *filter; | 187 | struct blk_cmd_filter *filter; |
201 | 188 | ||
202 | if (!capable(CAP_SYS_RAWIO)) | 189 | if (!capable(CAP_SYS_RAWIO)) |
203 | return -EPERM; | 190 | return -EPERM; |
@@ -205,7 +192,7 @@ rcf_attr_store(struct kobject *kobj, struct attribute *attr, | |||
205 | if (!entry->store) | 192 | if (!entry->store) |
206 | return -EINVAL; | 193 | return -EINVAL; |
207 | 194 | ||
208 | filter = container_of(kobj, struct blk_scsi_cmd_filter, kobj); | 195 | filter = container_of(kobj, struct blk_cmd_filter, kobj); |
209 | return entry->store(filter, page, length); | 196 | return entry->store(filter, page, length); |
210 | } | 197 | } |
211 | 198 | ||
@@ -219,114 +206,27 @@ static struct kobj_type rcf_ktype = { | |||
219 | .default_attrs = default_attrs, | 206 | .default_attrs = default_attrs, |
220 | }; | 207 | }; |
221 | 208 | ||
222 | #ifndef MAINTENANCE_IN_CMD | ||
223 | #define MAINTENANCE_IN_CMD 0xa3 | ||
224 | #endif | ||
225 | |||
226 | static void rcf_set_defaults(struct blk_scsi_cmd_filter *filter) | ||
227 | { | ||
228 | /* Basic read-only commands */ | ||
229 | __set_bit(TEST_UNIT_READY, filter->read_ok); | ||
230 | __set_bit(REQUEST_SENSE, filter->read_ok); | ||
231 | __set_bit(READ_6, filter->read_ok); | ||
232 | __set_bit(READ_10, filter->read_ok); | ||
233 | __set_bit(READ_12, filter->read_ok); | ||
234 | __set_bit(READ_16, filter->read_ok); | ||
235 | __set_bit(READ_BUFFER, filter->read_ok); | ||
236 | __set_bit(READ_DEFECT_DATA, filter->read_ok); | ||
237 | __set_bit(READ_CAPACITY, filter->read_ok); | ||
238 | __set_bit(READ_LONG, filter->read_ok); | ||
239 | __set_bit(INQUIRY, filter->read_ok); | ||
240 | __set_bit(MODE_SENSE, filter->read_ok); | ||
241 | __set_bit(MODE_SENSE_10, filter->read_ok); | ||
242 | __set_bit(LOG_SENSE, filter->read_ok); | ||
243 | __set_bit(START_STOP, filter->read_ok); | ||
244 | __set_bit(GPCMD_VERIFY_10, filter->read_ok); | ||
245 | __set_bit(VERIFY_16, filter->read_ok); | ||
246 | __set_bit(REPORT_LUNS, filter->read_ok); | ||
247 | __set_bit(SERVICE_ACTION_IN, filter->read_ok); | ||
248 | __set_bit(RECEIVE_DIAGNOSTIC, filter->read_ok); | ||
249 | __set_bit(MAINTENANCE_IN_CMD, filter->read_ok); | ||
250 | __set_bit(GPCMD_READ_BUFFER_CAPACITY, filter->read_ok); | ||
251 | |||
252 | /* Audio CD commands */ | ||
253 | __set_bit(GPCMD_PLAY_CD, filter->read_ok); | ||
254 | __set_bit(GPCMD_PLAY_AUDIO_10, filter->read_ok); | ||
255 | __set_bit(GPCMD_PLAY_AUDIO_MSF, filter->read_ok); | ||
256 | __set_bit(GPCMD_PLAY_AUDIO_TI, filter->read_ok); | ||
257 | __set_bit(GPCMD_PAUSE_RESUME, filter->read_ok); | ||
258 | |||
259 | /* CD/DVD data reading */ | ||
260 | __set_bit(GPCMD_READ_CD, filter->read_ok); | ||
261 | __set_bit(GPCMD_READ_CD_MSF, filter->read_ok); | ||
262 | __set_bit(GPCMD_READ_DISC_INFO, filter->read_ok); | ||
263 | __set_bit(GPCMD_READ_CDVD_CAPACITY, filter->read_ok); | ||
264 | __set_bit(GPCMD_READ_DVD_STRUCTURE, filter->read_ok); | ||
265 | __set_bit(GPCMD_READ_HEADER, filter->read_ok); | ||
266 | __set_bit(GPCMD_READ_TRACK_RZONE_INFO, filter->read_ok); | ||
267 | __set_bit(GPCMD_READ_SUBCHANNEL, filter->read_ok); | ||
268 | __set_bit(GPCMD_READ_TOC_PMA_ATIP, filter->read_ok); | ||
269 | __set_bit(GPCMD_REPORT_KEY, filter->read_ok); | ||
270 | __set_bit(GPCMD_SCAN, filter->read_ok); | ||
271 | __set_bit(GPCMD_GET_CONFIGURATION, filter->read_ok); | ||
272 | __set_bit(GPCMD_READ_FORMAT_CAPACITIES, filter->read_ok); | ||
273 | __set_bit(GPCMD_GET_EVENT_STATUS_NOTIFICATION, filter->read_ok); | ||
274 | __set_bit(GPCMD_GET_PERFORMANCE, filter->read_ok); | ||
275 | __set_bit(GPCMD_SEEK, filter->read_ok); | ||
276 | __set_bit(GPCMD_STOP_PLAY_SCAN, filter->read_ok); | ||
277 | |||
278 | /* Basic writing commands */ | ||
279 | __set_bit(WRITE_6, filter->write_ok); | ||
280 | __set_bit(WRITE_10, filter->write_ok); | ||
281 | __set_bit(WRITE_VERIFY, filter->write_ok); | ||
282 | __set_bit(WRITE_12, filter->write_ok); | ||
283 | __set_bit(WRITE_VERIFY_12, filter->write_ok); | ||
284 | __set_bit(WRITE_16, filter->write_ok); | ||
285 | __set_bit(WRITE_LONG, filter->write_ok); | ||
286 | __set_bit(WRITE_LONG_2, filter->write_ok); | ||
287 | __set_bit(ERASE, filter->write_ok); | ||
288 | __set_bit(GPCMD_MODE_SELECT_10, filter->write_ok); | ||
289 | __set_bit(MODE_SELECT, filter->write_ok); | ||
290 | __set_bit(LOG_SELECT, filter->write_ok); | ||
291 | __set_bit(GPCMD_BLANK, filter->write_ok); | ||
292 | __set_bit(GPCMD_CLOSE_TRACK, filter->write_ok); | ||
293 | __set_bit(GPCMD_FLUSH_CACHE, filter->write_ok); | ||
294 | __set_bit(GPCMD_FORMAT_UNIT, filter->write_ok); | ||
295 | __set_bit(GPCMD_REPAIR_RZONE_TRACK, filter->write_ok); | ||
296 | __set_bit(GPCMD_RESERVE_RZONE_TRACK, filter->write_ok); | ||
297 | __set_bit(GPCMD_SEND_DVD_STRUCTURE, filter->write_ok); | ||
298 | __set_bit(GPCMD_SEND_EVENT, filter->write_ok); | ||
299 | __set_bit(GPCMD_SEND_KEY, filter->write_ok); | ||
300 | __set_bit(GPCMD_SEND_OPC, filter->write_ok); | ||
301 | __set_bit(GPCMD_SEND_CUE_SHEET, filter->write_ok); | ||
302 | __set_bit(GPCMD_SET_SPEED, filter->write_ok); | ||
303 | __set_bit(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, filter->write_ok); | ||
304 | __set_bit(GPCMD_LOAD_UNLOAD, filter->write_ok); | ||
305 | __set_bit(GPCMD_SET_STREAMING, filter->write_ok); | ||
306 | } | ||
307 | |||
308 | int blk_register_filter(struct gendisk *disk) | 209 | int blk_register_filter(struct gendisk *disk) |
309 | { | 210 | { |
310 | int ret; | 211 | int ret; |
311 | struct blk_scsi_cmd_filter *filter = &disk->cmd_filter; | 212 | struct blk_cmd_filter *filter = &disk->queue->cmd_filter; |
312 | struct kobject *parent = kobject_get(disk->holder_dir->parent); | 213 | struct kobject *parent = kobject_get(disk->holder_dir->parent); |
313 | 214 | ||
314 | if (!parent) | 215 | if (!parent) |
315 | return -ENODEV; | 216 | return -ENODEV; |
316 | 217 | ||
317 | ret = kobject_init_and_add(&filter->kobj, &rcf_ktype, parent, | 218 | ret = kobject_init_and_add(&filter->kobj, &rcf_ktype, parent, |
318 | "%s", "cmd_filter"); | 219 | "%s", "cmd_filter"); |
319 | 220 | ||
320 | if (ret < 0) | 221 | if (ret < 0) |
321 | return ret; | 222 | return ret; |
322 | 223 | ||
323 | rcf_set_defaults(filter); | ||
324 | return 0; | 224 | return 0; |
325 | } | 225 | } |
326 | 226 | ||
327 | void blk_unregister_filter(struct gendisk *disk) | 227 | void blk_unregister_filter(struct gendisk *disk) |
328 | { | 228 | { |
329 | struct blk_scsi_cmd_filter *filter = &disk->cmd_filter; | 229 | struct blk_cmd_filter *filter = &disk->queue->cmd_filter; |
330 | 230 | ||
331 | kobject_put(&filter->kobj); | 231 | kobject_put(&filter->kobj); |
332 | kobject_put(disk->holder_dir->parent); | 232 | kobject_put(disk->holder_dir->parent); |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 12a5182173f6..ec4b7f234626 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -105,12 +105,96 @@ static int sg_emulated_host(struct request_queue *q, int __user *p) | |||
105 | return put_user(1, p); | 105 | return put_user(1, p); |
106 | } | 106 | } |
107 | 107 | ||
108 | void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter) | ||
109 | { | ||
110 | /* Basic read-only commands */ | ||
111 | __set_bit(TEST_UNIT_READY, filter->read_ok); | ||
112 | __set_bit(REQUEST_SENSE, filter->read_ok); | ||
113 | __set_bit(READ_6, filter->read_ok); | ||
114 | __set_bit(READ_10, filter->read_ok); | ||
115 | __set_bit(READ_12, filter->read_ok); | ||
116 | __set_bit(READ_16, filter->read_ok); | ||
117 | __set_bit(READ_BUFFER, filter->read_ok); | ||
118 | __set_bit(READ_DEFECT_DATA, filter->read_ok); | ||
119 | __set_bit(READ_CAPACITY, filter->read_ok); | ||
120 | __set_bit(READ_LONG, filter->read_ok); | ||
121 | __set_bit(INQUIRY, filter->read_ok); | ||
122 | __set_bit(MODE_SENSE, filter->read_ok); | ||
123 | __set_bit(MODE_SENSE_10, filter->read_ok); | ||
124 | __set_bit(LOG_SENSE, filter->read_ok); | ||
125 | __set_bit(START_STOP, filter->read_ok); | ||
126 | __set_bit(GPCMD_VERIFY_10, filter->read_ok); | ||
127 | __set_bit(VERIFY_16, filter->read_ok); | ||
128 | __set_bit(REPORT_LUNS, filter->read_ok); | ||
129 | __set_bit(SERVICE_ACTION_IN, filter->read_ok); | ||
130 | __set_bit(RECEIVE_DIAGNOSTIC, filter->read_ok); | ||
131 | __set_bit(MAINTENANCE_IN, filter->read_ok); | ||
132 | __set_bit(GPCMD_READ_BUFFER_CAPACITY, filter->read_ok); | ||
133 | |||
134 | /* Audio CD commands */ | ||
135 | __set_bit(GPCMD_PLAY_CD, filter->read_ok); | ||
136 | __set_bit(GPCMD_PLAY_AUDIO_10, filter->read_ok); | ||
137 | __set_bit(GPCMD_PLAY_AUDIO_MSF, filter->read_ok); | ||
138 | __set_bit(GPCMD_PLAY_AUDIO_TI, filter->read_ok); | ||
139 | __set_bit(GPCMD_PAUSE_RESUME, filter->read_ok); | ||
140 | |||
141 | /* CD/DVD data reading */ | ||
142 | __set_bit(GPCMD_READ_CD, filter->read_ok); | ||
143 | __set_bit(GPCMD_READ_CD_MSF, filter->read_ok); | ||
144 | __set_bit(GPCMD_READ_DISC_INFO, filter->read_ok); | ||
145 | __set_bit(GPCMD_READ_CDVD_CAPACITY, filter->read_ok); | ||
146 | __set_bit(GPCMD_READ_DVD_STRUCTURE, filter->read_ok); | ||
147 | __set_bit(GPCMD_READ_HEADER, filter->read_ok); | ||
148 | __set_bit(GPCMD_READ_TRACK_RZONE_INFO, filter->read_ok); | ||
149 | __set_bit(GPCMD_READ_SUBCHANNEL, filter->read_ok); | ||
150 | __set_bit(GPCMD_READ_TOC_PMA_ATIP, filter->read_ok); | ||
151 | __set_bit(GPCMD_REPORT_KEY, filter->read_ok); | ||
152 | __set_bit(GPCMD_SCAN, filter->read_ok); | ||
153 | __set_bit(GPCMD_GET_CONFIGURATION, filter->read_ok); | ||
154 | __set_bit(GPCMD_READ_FORMAT_CAPACITIES, filter->read_ok); | ||
155 | __set_bit(GPCMD_GET_EVENT_STATUS_NOTIFICATION, filter->read_ok); | ||
156 | __set_bit(GPCMD_GET_PERFORMANCE, filter->read_ok); | ||
157 | __set_bit(GPCMD_SEEK, filter->read_ok); | ||
158 | __set_bit(GPCMD_STOP_PLAY_SCAN, filter->read_ok); | ||
159 | |||
160 | /* Basic writing commands */ | ||
161 | __set_bit(WRITE_6, filter->write_ok); | ||
162 | __set_bit(WRITE_10, filter->write_ok); | ||
163 | __set_bit(WRITE_VERIFY, filter->write_ok); | ||
164 | __set_bit(WRITE_12, filter->write_ok); | ||
165 | __set_bit(WRITE_VERIFY_12, filter->write_ok); | ||
166 | __set_bit(WRITE_16, filter->write_ok); | ||
167 | __set_bit(WRITE_LONG, filter->write_ok); | ||
168 | __set_bit(WRITE_LONG_2, filter->write_ok); | ||
169 | __set_bit(ERASE, filter->write_ok); | ||
170 | __set_bit(GPCMD_MODE_SELECT_10, filter->write_ok); | ||
171 | __set_bit(MODE_SELECT, filter->write_ok); | ||
172 | __set_bit(LOG_SELECT, filter->write_ok); | ||
173 | __set_bit(GPCMD_BLANK, filter->write_ok); | ||
174 | __set_bit(GPCMD_CLOSE_TRACK, filter->write_ok); | ||
175 | __set_bit(GPCMD_FLUSH_CACHE, filter->write_ok); | ||
176 | __set_bit(GPCMD_FORMAT_UNIT, filter->write_ok); | ||
177 | __set_bit(GPCMD_REPAIR_RZONE_TRACK, filter->write_ok); | ||
178 | __set_bit(GPCMD_RESERVE_RZONE_TRACK, filter->write_ok); | ||
179 | __set_bit(GPCMD_SEND_DVD_STRUCTURE, filter->write_ok); | ||
180 | __set_bit(GPCMD_SEND_EVENT, filter->write_ok); | ||
181 | __set_bit(GPCMD_SEND_KEY, filter->write_ok); | ||
182 | __set_bit(GPCMD_SEND_OPC, filter->write_ok); | ||
183 | __set_bit(GPCMD_SEND_CUE_SHEET, filter->write_ok); | ||
184 | __set_bit(GPCMD_SET_SPEED, filter->write_ok); | ||
185 | __set_bit(GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL, filter->write_ok); | ||
186 | __set_bit(GPCMD_LOAD_UNLOAD, filter->write_ok); | ||
187 | __set_bit(GPCMD_SET_STREAMING, filter->write_ok); | ||
188 | } | ||
189 | EXPORT_SYMBOL_GPL(blk_set_cmd_filter_defaults); | ||
190 | |||
108 | static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, | 191 | static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq, |
109 | struct sg_io_hdr *hdr, struct file *file) | 192 | struct sg_io_hdr *hdr, struct file *file) |
110 | { | 193 | { |
111 | if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len)) | 194 | if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len)) |
112 | return -EFAULT; | 195 | return -EFAULT; |
113 | if (blk_verify_command(file, rq->cmd)) | 196 | if (blk_verify_command(&q->cmd_filter, rq->cmd, |
197 | file->f_mode & FMODE_WRITE)) | ||
114 | return -EPERM; | 198 | return -EPERM; |
115 | 199 | ||
116 | /* | 200 | /* |
@@ -298,7 +382,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q, | |||
298 | struct gendisk *disk, struct scsi_ioctl_command __user *sic) | 382 | struct gendisk *disk, struct scsi_ioctl_command __user *sic) |
299 | { | 383 | { |
300 | struct request *rq; | 384 | struct request *rq; |
301 | int err; | 385 | int err, write_perm = 0; |
302 | unsigned int in_len, out_len, bytes, opcode, cmdlen; | 386 | unsigned int in_len, out_len, bytes, opcode, cmdlen; |
303 | char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE]; | 387 | char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE]; |
304 | 388 | ||
@@ -340,7 +424,11 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q, | |||
340 | if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len)) | 424 | if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len)) |
341 | goto error; | 425 | goto error; |
342 | 426 | ||
343 | err = blk_verify_command(file, rq->cmd); | 427 | /* scsi_ioctl passes NULL */ |
428 | if (file && (file->f_mode & FMODE_WRITE)) | ||
429 | write_perm = 1; | ||
430 | |||
431 | err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm); | ||
344 | if (err) | 432 | if (err) |
345 | goto error; | 433 | goto error; |
346 | 434 | ||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 158eed4d5161..29b7a648cc6e 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/types.h> | 49 | #include <linux/types.h> |
50 | #include <linux/kernel.h> | 50 | #include <linux/kernel.h> |
51 | #include <linux/kthread.h> | 51 | #include <linux/kthread.h> |
52 | #include <linux/smp_lock.h> | ||
53 | #include <linux/errno.h> | 52 | #include <linux/errno.h> |
54 | #include <linux/spinlock.h> | 53 | #include <linux/spinlock.h> |
55 | #include <linux/file.h> | 54 | #include <linux/file.h> |
@@ -2798,14 +2797,9 @@ out_mem: | |||
2798 | return ret; | 2797 | return ret; |
2799 | } | 2798 | } |
2800 | 2799 | ||
2801 | static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 2800 | static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
2802 | { | 2801 | { |
2803 | struct inode *inode = file->f_path.dentry->d_inode; | 2802 | struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; |
2804 | struct pktcdvd_device *pd; | ||
2805 | long ret; | ||
2806 | |||
2807 | lock_kernel(); | ||
2808 | pd = inode->i_bdev->bd_disk->private_data; | ||
2809 | 2803 | ||
2810 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); | 2804 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); |
2811 | 2805 | ||
@@ -2818,8 +2812,7 @@ static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2818 | case CDROM_LAST_WRITTEN: | 2812 | case CDROM_LAST_WRITTEN: |
2819 | case CDROM_SEND_PACKET: | 2813 | case CDROM_SEND_PACKET: |
2820 | case SCSI_IOCTL_SEND_COMMAND: | 2814 | case SCSI_IOCTL_SEND_COMMAND: |
2821 | ret = blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); | 2815 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
2822 | break; | ||
2823 | 2816 | ||
2824 | case CDROMEJECT: | 2817 | case CDROMEJECT: |
2825 | /* | 2818 | /* |
@@ -2828,15 +2821,14 @@ static long pkt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2828 | */ | 2821 | */ |
2829 | if (pd->refcnt == 1) | 2822 | if (pd->refcnt == 1) |
2830 | pkt_lock_door(pd, 0); | 2823 | pkt_lock_door(pd, 0); |
2831 | ret = blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); | 2824 | return blkdev_ioctl(pd->bdev->bd_inode, file, cmd, arg); |
2832 | break; | ||
2833 | 2825 | ||
2834 | default: | 2826 | default: |
2835 | VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd); | 2827 | VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd); |
2836 | ret = -ENOTTY; | 2828 | return -ENOTTY; |
2837 | } | 2829 | } |
2838 | unlock_kernel(); | 2830 | |
2839 | return ret; | 2831 | return 0; |
2840 | } | 2832 | } |
2841 | 2833 | ||
2842 | static int pkt_media_changed(struct gendisk *disk) | 2834 | static int pkt_media_changed(struct gendisk *disk) |
@@ -2858,7 +2850,7 @@ static struct block_device_operations pktcdvd_ops = { | |||
2858 | .owner = THIS_MODULE, | 2850 | .owner = THIS_MODULE, |
2859 | .open = pkt_open, | 2851 | .open = pkt_open, |
2860 | .release = pkt_close, | 2852 | .release = pkt_close, |
2861 | .unlocked_ioctl = pkt_ioctl, | 2853 | .ioctl = pkt_ioctl, |
2862 | .media_changed = pkt_media_changed, | 2854 | .media_changed = pkt_media_changed, |
2863 | }; | 2855 | }; |
2864 | 2856 | ||
@@ -3023,8 +3015,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd) | |||
3023 | mutex_unlock(&ctl_mutex); | 3015 | mutex_unlock(&ctl_mutex); |
3024 | } | 3016 | } |
3025 | 3017 | ||
3026 | static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | 3018 | static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
3027 | unsigned long arg) | ||
3028 | { | 3019 | { |
3029 | void __user *argp = (void __user *)arg; | 3020 | void __user *argp = (void __user *)arg; |
3030 | struct pkt_ctrl_command ctrl_cmd; | 3021 | struct pkt_ctrl_command ctrl_cmd; |
@@ -3041,22 +3032,16 @@ static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | |||
3041 | case PKT_CTRL_CMD_SETUP: | 3032 | case PKT_CTRL_CMD_SETUP: |
3042 | if (!capable(CAP_SYS_ADMIN)) | 3033 | if (!capable(CAP_SYS_ADMIN)) |
3043 | return -EPERM; | 3034 | return -EPERM; |
3044 | lock_kernel(); | ||
3045 | ret = pkt_setup_dev(new_decode_dev(ctrl_cmd.dev), &pkt_dev); | 3035 | ret = pkt_setup_dev(new_decode_dev(ctrl_cmd.dev), &pkt_dev); |
3046 | ctrl_cmd.pkt_dev = new_encode_dev(pkt_dev); | 3036 | ctrl_cmd.pkt_dev = new_encode_dev(pkt_dev); |
3047 | unlock_kernel(); | ||
3048 | break; | 3037 | break; |
3049 | case PKT_CTRL_CMD_TEARDOWN: | 3038 | case PKT_CTRL_CMD_TEARDOWN: |
3050 | if (!capable(CAP_SYS_ADMIN)) | 3039 | if (!capable(CAP_SYS_ADMIN)) |
3051 | return -EPERM; | 3040 | return -EPERM; |
3052 | lock_kernel(); | ||
3053 | ret = pkt_remove_dev(new_decode_dev(ctrl_cmd.pkt_dev)); | 3041 | ret = pkt_remove_dev(new_decode_dev(ctrl_cmd.pkt_dev)); |
3054 | unlock_kernel(); | ||
3055 | break; | 3042 | break; |
3056 | case PKT_CTRL_CMD_STATUS: | 3043 | case PKT_CTRL_CMD_STATUS: |
3057 | lock_kernel(); | ||
3058 | pkt_get_status(&ctrl_cmd); | 3044 | pkt_get_status(&ctrl_cmd); |
3059 | unlock_kernel(); | ||
3060 | break; | 3045 | break; |
3061 | default: | 3046 | default: |
3062 | return -ENOTTY; | 3047 | return -ENOTTY; |
@@ -3069,7 +3054,7 @@ static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, | |||
3069 | 3054 | ||
3070 | 3055 | ||
3071 | static const struct file_operations pkt_ctl_fops = { | 3056 | static const struct file_operations pkt_ctl_fops = { |
3072 | .unlocked_ioctl = pkt_ctl_ioctl, | 3057 | .ioctl = pkt_ctl_ioctl, |
3073 | .owner = THIS_MODULE, | 3058 | .owner = THIS_MODULE, |
3074 | }; | 3059 | }; |
3075 | 3060 | ||
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a27160ba21d7..daeb8f766971 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -2498,7 +2498,7 @@ static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg) | |||
2498 | /** | 2498 | /** |
2499 | * tty_do_resize - resize event | 2499 | * tty_do_resize - resize event |
2500 | * @tty: tty being resized | 2500 | * @tty: tty being resized |
2501 | * @real_tty: real tty (if using a pty/tty pair) | 2501 | * @real_tty: real tty (not the same as tty if using a pty/tty pair) |
2502 | * @rows: rows (character) | 2502 | * @rows: rows (character) |
2503 | * @cols: cols (character) | 2503 | * @cols: cols (character) |
2504 | * | 2504 | * |
@@ -2512,7 +2512,8 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
2512 | struct pid *pgrp, *rpgrp; | 2512 | struct pid *pgrp, *rpgrp; |
2513 | unsigned long flags; | 2513 | unsigned long flags; |
2514 | 2514 | ||
2515 | mutex_lock(&tty->termios_mutex); | 2515 | /* For a PTY we need to lock the tty side */ |
2516 | mutex_lock(&real_tty->termios_mutex); | ||
2516 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) | 2517 | if (!memcmp(ws, &tty->winsize, sizeof(*ws))) |
2517 | goto done; | 2518 | goto done; |
2518 | /* Get the PID values and reference them so we can | 2519 | /* Get the PID values and reference them so we can |
@@ -2533,7 +2534,7 @@ int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, | |||
2533 | tty->winsize = *ws; | 2534 | tty->winsize = *ws; |
2534 | real_tty->winsize = *ws; | 2535 | real_tty->winsize = *ws; |
2535 | done: | 2536 | done: |
2536 | mutex_unlock(&tty->termios_mutex); | 2537 | mutex_unlock(&real_tty->termios_mutex); |
2537 | return 0; | 2538 | return 0; |
2538 | } | 2539 | } |
2539 | 2540 | ||
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index ea9fc5d03b99..bf34e4597421 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -937,12 +937,14 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, | |||
937 | return 0; | 937 | return 0; |
938 | #endif | 938 | #endif |
939 | case TIOCGSOFTCAR: | 939 | case TIOCGSOFTCAR: |
940 | return put_user(C_CLOCAL(tty) ? 1 : 0, | 940 | /* FIXME: for correctness we may need to take the termios |
941 | lock here - review */ | ||
942 | return put_user(C_CLOCAL(real_tty) ? 1 : 0, | ||
941 | (int __user *)arg); | 943 | (int __user *)arg); |
942 | case TIOCSSOFTCAR: | 944 | case TIOCSSOFTCAR: |
943 | if (get_user(arg, (unsigned int __user *) arg)) | 945 | if (get_user(arg, (unsigned int __user *) arg)) |
944 | return -EFAULT; | 946 | return -EFAULT; |
945 | return tty_change_softcar(tty, arg); | 947 | return tty_change_softcar(real_tty, arg); |
946 | default: | 948 | default: |
947 | return -ENOIOCTLCMD; | 949 | return -ENOIOCTLCMD; |
948 | } | 950 | } |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 089c015c01d1..53f0e5af1cc8 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -400,27 +400,31 @@ static void drm_locked_tasklet_func(unsigned long data) | |||
400 | { | 400 | { |
401 | struct drm_device *dev = (struct drm_device *)data; | 401 | struct drm_device *dev = (struct drm_device *)data; |
402 | unsigned long irqflags; | 402 | unsigned long irqflags; |
403 | 403 | void (*tasklet_func)(struct drm_device *); | |
404 | |||
404 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | 405 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); |
406 | tasklet_func = dev->locked_tasklet_func; | ||
407 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
405 | 408 | ||
406 | if (!dev->locked_tasklet_func || | 409 | if (!tasklet_func || |
407 | !drm_lock_take(&dev->lock, | 410 | !drm_lock_take(&dev->lock, |
408 | DRM_KERNEL_CONTEXT)) { | 411 | DRM_KERNEL_CONTEXT)) { |
409 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
410 | return; | 412 | return; |
411 | } | 413 | } |
412 | 414 | ||
413 | dev->lock.lock_time = jiffies; | 415 | dev->lock.lock_time = jiffies; |
414 | atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); | 416 | atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); |
415 | 417 | ||
416 | dev->locked_tasklet_func(dev); | 418 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); |
419 | tasklet_func = dev->locked_tasklet_func; | ||
420 | dev->locked_tasklet_func = NULL; | ||
421 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
422 | |||
423 | if (tasklet_func != NULL) | ||
424 | tasklet_func(dev); | ||
417 | 425 | ||
418 | drm_lock_free(&dev->lock, | 426 | drm_lock_free(&dev->lock, |
419 | DRM_KERNEL_CONTEXT); | 427 | DRM_KERNEL_CONTEXT); |
420 | |||
421 | dev->locked_tasklet_func = NULL; | ||
422 | |||
423 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | ||
424 | } | 428 | } |
425 | 429 | ||
426 | /** | 430 | /** |
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c index 0998723cde79..a4caf95485d7 100644 --- a/drivers/gpu/drm/drm_lock.c +++ b/drivers/gpu/drm/drm_lock.c | |||
@@ -105,14 +105,19 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
105 | ret ? "interrupted" : "has lock"); | 105 | ret ? "interrupted" : "has lock"); |
106 | if (ret) return ret; | 106 | if (ret) return ret; |
107 | 107 | ||
108 | sigemptyset(&dev->sigmask); | 108 | /* don't set the block all signals on the master process for now |
109 | sigaddset(&dev->sigmask, SIGSTOP); | 109 | * really probably not the correct answer but lets us debug xkb |
110 | sigaddset(&dev->sigmask, SIGTSTP); | 110 | * xserver for now */ |
111 | sigaddset(&dev->sigmask, SIGTTIN); | 111 | if (!file_priv->master) { |
112 | sigaddset(&dev->sigmask, SIGTTOU); | 112 | sigemptyset(&dev->sigmask); |
113 | dev->sigdata.context = lock->context; | 113 | sigaddset(&dev->sigmask, SIGSTOP); |
114 | dev->sigdata.lock = dev->lock.hw_lock; | 114 | sigaddset(&dev->sigmask, SIGTSTP); |
115 | block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); | 115 | sigaddset(&dev->sigmask, SIGTTIN); |
116 | sigaddset(&dev->sigmask, SIGTTOU); | ||
117 | dev->sigdata.context = lock->context; | ||
118 | dev->sigdata.lock = dev->lock.hw_lock; | ||
119 | block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); | ||
120 | } | ||
116 | 121 | ||
117 | if (dev->driver->dma_ready && (lock->flags & _DRM_LOCK_READY)) | 122 | if (dev->driver->dma_ready && (lock->flags & _DRM_LOCK_READY)) |
118 | dev->driver->dma_ready(dev); | 123 | dev->driver->dma_ready(dev); |
@@ -150,6 +155,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
150 | { | 155 | { |
151 | struct drm_lock *lock = data; | 156 | struct drm_lock *lock = data; |
152 | unsigned long irqflags; | 157 | unsigned long irqflags; |
158 | void (*tasklet_func)(struct drm_device *); | ||
153 | 159 | ||
154 | if (lock->context == DRM_KERNEL_CONTEXT) { | 160 | if (lock->context == DRM_KERNEL_CONTEXT) { |
155 | DRM_ERROR("Process %d using kernel context %d\n", | 161 | DRM_ERROR("Process %d using kernel context %d\n", |
@@ -158,14 +164,11 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
158 | } | 164 | } |
159 | 165 | ||
160 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); | 166 | spin_lock_irqsave(&dev->tasklet_lock, irqflags); |
161 | 167 | tasklet_func = dev->locked_tasklet_func; | |
162 | if (dev->locked_tasklet_func) { | 168 | dev->locked_tasklet_func = NULL; |
163 | dev->locked_tasklet_func(dev); | ||
164 | |||
165 | dev->locked_tasklet_func = NULL; | ||
166 | } | ||
167 | |||
168 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); | 169 | spin_unlock_irqrestore(&dev->tasklet_lock, irqflags); |
170 | if (tasklet_func != NULL) | ||
171 | tasklet_func(dev); | ||
169 | 172 | ||
170 | atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]); | 173 | atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]); |
171 | 174 | ||
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c index 702df45320f7..4b27d9abb7bc 100644 --- a/drivers/gpu/drm/radeon/r300_cmdbuf.c +++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c | |||
@@ -77,6 +77,9 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, | |||
77 | return -EFAULT; | 77 | return -EFAULT; |
78 | } | 78 | } |
79 | 79 | ||
80 | box.x2--; /* Hardware expects inclusive bottom-right corner */ | ||
81 | box.y2--; | ||
82 | |||
80 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) { | 83 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) { |
81 | box.x1 = (box.x1) & | 84 | box.x1 = (box.x1) & |
82 | R300_CLIPRECT_MASK; | 85 | R300_CLIPRECT_MASK; |
@@ -95,8 +98,8 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, | |||
95 | R300_CLIPRECT_MASK; | 98 | R300_CLIPRECT_MASK; |
96 | box.y2 = (box.y2 + R300_CLIPRECT_OFFSET) & | 99 | box.y2 = (box.y2 + R300_CLIPRECT_OFFSET) & |
97 | R300_CLIPRECT_MASK; | 100 | R300_CLIPRECT_MASK; |
98 | |||
99 | } | 101 | } |
102 | |||
100 | OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) | | 103 | OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) | |
101 | (box.y1 << R300_CLIPRECT_Y_SHIFT)); | 104 | (box.y1 << R300_CLIPRECT_Y_SHIFT)); |
102 | OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) | | 105 | OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) | |
@@ -136,6 +139,18 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, | |||
136 | ADVANCE_RING(); | 139 | ADVANCE_RING(); |
137 | } | 140 | } |
138 | 141 | ||
142 | /* flus cache and wait idle clean after cliprect change */ | ||
143 | BEGIN_RING(2); | ||
144 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
145 | OUT_RING(R300_RB3D_DC_FLUSH); | ||
146 | ADVANCE_RING(); | ||
147 | BEGIN_RING(2); | ||
148 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
149 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
150 | ADVANCE_RING(); | ||
151 | /* set flush flag */ | ||
152 | dev_priv->track_flush |= RADEON_FLUSH_EMITED; | ||
153 | |||
139 | return 0; | 154 | return 0; |
140 | } | 155 | } |
141 | 156 | ||
@@ -166,13 +181,13 @@ void r300_init_reg_flags(struct drm_device *dev) | |||
166 | ADD_RANGE(0x21DC, 1); | 181 | ADD_RANGE(0x21DC, 1); |
167 | ADD_RANGE(R300_VAP_UNKNOWN_221C, 1); | 182 | ADD_RANGE(R300_VAP_UNKNOWN_221C, 1); |
168 | ADD_RANGE(R300_VAP_CLIP_X_0, 4); | 183 | ADD_RANGE(R300_VAP_CLIP_X_0, 4); |
169 | ADD_RANGE(R300_VAP_PVS_WAITIDLE, 1); | 184 | ADD_RANGE(R300_VAP_PVS_STATE_FLUSH_REG, 1); |
170 | ADD_RANGE(R300_VAP_UNKNOWN_2288, 1); | 185 | ADD_RANGE(R300_VAP_UNKNOWN_2288, 1); |
171 | ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2); | 186 | ADD_RANGE(R300_VAP_OUTPUT_VTX_FMT_0, 2); |
172 | ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); | 187 | ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); |
173 | ADD_RANGE(R300_GB_ENABLE, 1); | 188 | ADD_RANGE(R300_GB_ENABLE, 1); |
174 | ADD_RANGE(R300_GB_MSPOS0, 5); | 189 | ADD_RANGE(R300_GB_MSPOS0, 5); |
175 | ADD_RANGE(R300_TX_CNTL, 1); | 190 | ADD_RANGE(R300_TX_INVALTAGS, 1); |
176 | ADD_RANGE(R300_TX_ENABLE, 1); | 191 | ADD_RANGE(R300_TX_ENABLE, 1); |
177 | ADD_RANGE(0x4200, 4); | 192 | ADD_RANGE(0x4200, 4); |
178 | ADD_RANGE(0x4214, 1); | 193 | ADD_RANGE(0x4214, 1); |
@@ -388,15 +403,28 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t *dev_priv, | |||
388 | if (sz * 16 > cmdbuf->bufsz) | 403 | if (sz * 16 > cmdbuf->bufsz) |
389 | return -EINVAL; | 404 | return -EINVAL; |
390 | 405 | ||
391 | BEGIN_RING(5 + sz * 4); | 406 | /* VAP is very sensitive so we purge cache before we program it |
392 | /* Wait for VAP to come to senses.. */ | 407 | * and we also flush its state before & after */ |
393 | /* there is no need to emit it multiple times, (only once before VAP is programmed, | 408 | BEGIN_RING(6); |
394 | but this optimization is for later */ | 409 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); |
395 | OUT_RING_REG(R300_VAP_PVS_WAITIDLE, 0); | 410 | OUT_RING(R300_RB3D_DC_FLUSH); |
411 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
412 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
413 | OUT_RING(CP_PACKET0(R300_VAP_PVS_STATE_FLUSH_REG, 0)); | ||
414 | OUT_RING(0); | ||
415 | ADVANCE_RING(); | ||
416 | /* set flush flag */ | ||
417 | dev_priv->track_flush |= RADEON_FLUSH_EMITED; | ||
418 | |||
419 | BEGIN_RING(3 + sz * 4); | ||
396 | OUT_RING_REG(R300_VAP_PVS_UPLOAD_ADDRESS, addr); | 420 | OUT_RING_REG(R300_VAP_PVS_UPLOAD_ADDRESS, addr); |
397 | OUT_RING(CP_PACKET0_TABLE(R300_VAP_PVS_UPLOAD_DATA, sz * 4 - 1)); | 421 | OUT_RING(CP_PACKET0_TABLE(R300_VAP_PVS_UPLOAD_DATA, sz * 4 - 1)); |
398 | OUT_RING_TABLE((int *)cmdbuf->buf, sz * 4); | 422 | OUT_RING_TABLE((int *)cmdbuf->buf, sz * 4); |
423 | ADVANCE_RING(); | ||
399 | 424 | ||
425 | BEGIN_RING(2); | ||
426 | OUT_RING(CP_PACKET0(R300_VAP_PVS_STATE_FLUSH_REG, 0)); | ||
427 | OUT_RING(0); | ||
400 | ADVANCE_RING(); | 428 | ADVANCE_RING(); |
401 | 429 | ||
402 | cmdbuf->buf += sz * 16; | 430 | cmdbuf->buf += sz * 16; |
@@ -424,6 +452,15 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t *dev_priv, | |||
424 | OUT_RING_TABLE((int *)cmdbuf->buf, 8); | 452 | OUT_RING_TABLE((int *)cmdbuf->buf, 8); |
425 | ADVANCE_RING(); | 453 | ADVANCE_RING(); |
426 | 454 | ||
455 | BEGIN_RING(4); | ||
456 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
457 | OUT_RING(R300_RB3D_DC_FLUSH); | ||
458 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
459 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
460 | ADVANCE_RING(); | ||
461 | /* set flush flag */ | ||
462 | dev_priv->track_flush |= RADEON_FLUSH_EMITED; | ||
463 | |||
427 | cmdbuf->buf += 8 * 4; | 464 | cmdbuf->buf += 8 * 4; |
428 | cmdbuf->bufsz -= 8 * 4; | 465 | cmdbuf->bufsz -= 8 * 4; |
429 | 466 | ||
@@ -543,22 +580,23 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, | |||
543 | return 0; | 580 | return 0; |
544 | } | 581 | } |
545 | 582 | ||
546 | static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv, | 583 | static __inline__ int r300_emit_draw_indx_2(drm_radeon_private_t *dev_priv, |
547 | drm_radeon_kcmd_buffer_t *cmdbuf) | 584 | drm_radeon_kcmd_buffer_t *cmdbuf) |
548 | { | 585 | { |
549 | u32 *cmd = (u32 *) cmdbuf->buf; | 586 | u32 *cmd; |
550 | int count, ret; | 587 | int count; |
588 | int expected_count; | ||
551 | RING_LOCALS; | 589 | RING_LOCALS; |
552 | 590 | ||
553 | count=(cmd[0]>>16) & 0x3fff; | 591 | cmd = (u32 *) cmdbuf->buf; |
592 | count = (cmd[0]>>16) & 0x3fff; | ||
593 | expected_count = cmd[1] >> 16; | ||
594 | if (!(cmd[1] & R300_VAP_VF_CNTL__INDEX_SIZE_32bit)) | ||
595 | expected_count = (expected_count+1)/2; | ||
554 | 596 | ||
555 | if ((cmd[1] & 0x8000ffff) != 0x80000810) { | 597 | if (count && count != expected_count) { |
556 | DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); | 598 | DRM_ERROR("3D_DRAW_INDX_2: packet size %i, expected %i\n", |
557 | return -EINVAL; | 599 | count, expected_count); |
558 | } | ||
559 | ret = !radeon_check_offset(dev_priv, cmd[2]); | ||
560 | if (ret) { | ||
561 | DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); | ||
562 | return -EINVAL; | 600 | return -EINVAL; |
563 | } | 601 | } |
564 | 602 | ||
@@ -570,6 +608,50 @@ static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv, | |||
570 | cmdbuf->buf += (count+2)*4; | 608 | cmdbuf->buf += (count+2)*4; |
571 | cmdbuf->bufsz -= (count+2)*4; | 609 | cmdbuf->bufsz -= (count+2)*4; |
572 | 610 | ||
611 | if (!count) { | ||
612 | drm_r300_cmd_header_t header; | ||
613 | |||
614 | if (cmdbuf->bufsz < 4*4 + sizeof(header)) { | ||
615 | DRM_ERROR("3D_DRAW_INDX_2: expect subsequent INDX_BUFFER, but stream is too short.\n"); | ||
616 | return -EINVAL; | ||
617 | } | ||
618 | |||
619 | header.u = *(unsigned int *)cmdbuf->buf; | ||
620 | |||
621 | cmdbuf->buf += sizeof(header); | ||
622 | cmdbuf->bufsz -= sizeof(header); | ||
623 | cmd = (u32 *) cmdbuf->buf; | ||
624 | |||
625 | if (header.header.cmd_type != R300_CMD_PACKET3 || | ||
626 | header.packet3.packet != R300_CMD_PACKET3_RAW || | ||
627 | cmd[0] != CP_PACKET3(RADEON_CP_INDX_BUFFER, 2)) { | ||
628 | DRM_ERROR("3D_DRAW_INDX_2: expect subsequent INDX_BUFFER.\n"); | ||
629 | return -EINVAL; | ||
630 | } | ||
631 | |||
632 | if ((cmd[1] & 0x8000ffff) != 0x80000810) { | ||
633 | DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); | ||
634 | return -EINVAL; | ||
635 | } | ||
636 | if (!radeon_check_offset(dev_priv, cmd[2])) { | ||
637 | DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); | ||
638 | return -EINVAL; | ||
639 | } | ||
640 | if (cmd[3] != expected_count) { | ||
641 | DRM_ERROR("INDX_BUFFER: buffer size %i, expected %i\n", | ||
642 | cmd[3], expected_count); | ||
643 | return -EINVAL; | ||
644 | } | ||
645 | |||
646 | BEGIN_RING(4); | ||
647 | OUT_RING(cmd[0]); | ||
648 | OUT_RING_TABLE((int *)(cmdbuf->buf + 4), 3); | ||
649 | ADVANCE_RING(); | ||
650 | |||
651 | cmdbuf->buf += 4*4; | ||
652 | cmdbuf->bufsz -= 4*4; | ||
653 | } | ||
654 | |||
573 | return 0; | 655 | return 0; |
574 | } | 656 | } |
575 | 657 | ||
@@ -613,11 +695,22 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, | |||
613 | case RADEON_CNTL_BITBLT_MULTI: | 695 | case RADEON_CNTL_BITBLT_MULTI: |
614 | return r300_emit_bitblt_multi(dev_priv, cmdbuf); | 696 | return r300_emit_bitblt_multi(dev_priv, cmdbuf); |
615 | 697 | ||
616 | case RADEON_CP_INDX_BUFFER: /* DRAW_INDX_2 without INDX_BUFFER seems to lock up the gpu */ | 698 | case RADEON_CP_INDX_BUFFER: |
617 | return r300_emit_indx_buffer(dev_priv, cmdbuf); | 699 | DRM_ERROR("packet3 INDX_BUFFER without preceding 3D_DRAW_INDX_2 is illegal.\n"); |
618 | case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ | 700 | return -EINVAL; |
619 | case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ | 701 | case RADEON_CP_3D_DRAW_IMMD_2: |
620 | case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ | 702 | /* triggers drawing using in-packet vertex data */ |
703 | case RADEON_CP_3D_DRAW_VBUF_2: | ||
704 | /* triggers drawing of vertex buffers setup elsewhere */ | ||
705 | dev_priv->track_flush &= ~(RADEON_FLUSH_EMITED | | ||
706 | RADEON_PURGE_EMITED); | ||
707 | break; | ||
708 | case RADEON_CP_3D_DRAW_INDX_2: | ||
709 | /* triggers drawing using indices to vertex buffer */ | ||
710 | /* whenever we send vertex we clear flush & purge */ | ||
711 | dev_priv->track_flush &= ~(RADEON_FLUSH_EMITED | | ||
712 | RADEON_PURGE_EMITED); | ||
713 | return r300_emit_draw_indx_2(dev_priv, cmdbuf); | ||
621 | case RADEON_WAIT_FOR_IDLE: | 714 | case RADEON_WAIT_FOR_IDLE: |
622 | case RADEON_CP_NOP: | 715 | case RADEON_CP_NOP: |
623 | /* these packets are safe */ | 716 | /* these packets are safe */ |
@@ -713,17 +806,53 @@ static __inline__ int r300_emit_packet3(drm_radeon_private_t *dev_priv, | |||
713 | */ | 806 | */ |
714 | static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv) | 807 | static __inline__ void r300_pacify(drm_radeon_private_t *dev_priv) |
715 | { | 808 | { |
809 | uint32_t cache_z, cache_3d, cache_2d; | ||
716 | RING_LOCALS; | 810 | RING_LOCALS; |
717 | 811 | ||
718 | BEGIN_RING(6); | 812 | cache_z = R300_ZC_FLUSH; |
719 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | 813 | cache_2d = R300_RB2D_DC_FLUSH; |
720 | OUT_RING(R300_RB3D_DSTCACHE_UNKNOWN_0A); | 814 | cache_3d = R300_RB3D_DC_FLUSH; |
815 | if (!(dev_priv->track_flush & RADEON_PURGE_EMITED)) { | ||
816 | /* we can purge, primitive where draw since last purge */ | ||
817 | cache_z |= R300_ZC_FREE; | ||
818 | cache_2d |= R300_RB2D_DC_FREE; | ||
819 | cache_3d |= R300_RB3D_DC_FREE; | ||
820 | } | ||
821 | |||
822 | /* flush & purge zbuffer */ | ||
823 | BEGIN_RING(2); | ||
721 | OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); | 824 | OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); |
722 | OUT_RING(R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE| | 825 | OUT_RING(cache_z); |
723 | R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); | 826 | ADVANCE_RING(); |
724 | OUT_RING(CP_PACKET3(RADEON_CP_NOP, 0)); | 827 | /* flush & purge 3d */ |
725 | OUT_RING(0x0); | 828 | BEGIN_RING(2); |
829 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
830 | OUT_RING(cache_3d); | ||
831 | ADVANCE_RING(); | ||
832 | /* flush & purge texture */ | ||
833 | BEGIN_RING(2); | ||
834 | OUT_RING(CP_PACKET0(R300_TX_INVALTAGS, 0)); | ||
835 | OUT_RING(0); | ||
836 | ADVANCE_RING(); | ||
837 | /* FIXME: is this one really needed ? */ | ||
838 | BEGIN_RING(2); | ||
839 | OUT_RING(CP_PACKET0(R300_RB3D_AARESOLVE_CTL, 0)); | ||
840 | OUT_RING(0); | ||
841 | ADVANCE_RING(); | ||
842 | BEGIN_RING(2); | ||
843 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
844 | OUT_RING(RADEON_WAIT_3D_IDLECLEAN); | ||
845 | ADVANCE_RING(); | ||
846 | /* flush & purge 2d through E2 as RB2D will trigger lockup */ | ||
847 | BEGIN_RING(4); | ||
848 | OUT_RING(CP_PACKET0(R300_DSTCACHE_CTLSTAT, 0)); | ||
849 | OUT_RING(cache_2d); | ||
850 | OUT_RING(CP_PACKET0(RADEON_WAIT_UNTIL, 0)); | ||
851 | OUT_RING(RADEON_WAIT_2D_IDLECLEAN | | ||
852 | RADEON_WAIT_HOST_IDLECLEAN); | ||
726 | ADVANCE_RING(); | 853 | ADVANCE_RING(); |
854 | /* set flush & purge flags */ | ||
855 | dev_priv->track_flush |= RADEON_FLUSH_EMITED | RADEON_PURGE_EMITED; | ||
727 | } | 856 | } |
728 | 857 | ||
729 | /** | 858 | /** |
@@ -905,8 +1034,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, | |||
905 | 1034 | ||
906 | DRM_DEBUG("\n"); | 1035 | DRM_DEBUG("\n"); |
907 | 1036 | ||
908 | /* See the comment above r300_emit_begin3d for why this call must be here, | 1037 | /* pacify */ |
909 | * and what the cleanup gotos are for. */ | ||
910 | r300_pacify(dev_priv); | 1038 | r300_pacify(dev_priv); |
911 | 1039 | ||
912 | if (cmdbuf->nbox <= R300_SIMULTANEOUS_CLIPRECTS) { | 1040 | if (cmdbuf->nbox <= R300_SIMULTANEOUS_CLIPRECTS) { |
diff --git a/drivers/gpu/drm/radeon/r300_reg.h b/drivers/gpu/drm/radeon/r300_reg.h index a6802f26afc4..ee6f811599a3 100644 --- a/drivers/gpu/drm/radeon/r300_reg.h +++ b/drivers/gpu/drm/radeon/r300_reg.h | |||
@@ -317,7 +317,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
317 | * Therefore, I suspect writing zero to 0x2284 synchronizes the engine and | 317 | * Therefore, I suspect writing zero to 0x2284 synchronizes the engine and |
318 | * avoids bugs caused by still running shaders reading bad data from memory. | 318 | * avoids bugs caused by still running shaders reading bad data from memory. |
319 | */ | 319 | */ |
320 | #define R300_VAP_PVS_WAITIDLE 0x2284 /* GUESS */ | 320 | #define R300_VAP_PVS_STATE_FLUSH_REG 0x2284 |
321 | 321 | ||
322 | /* Absolutely no clue what this register is about. */ | 322 | /* Absolutely no clue what this register is about. */ |
323 | #define R300_VAP_UNKNOWN_2288 0x2288 | 323 | #define R300_VAP_UNKNOWN_2288 0x2288 |
@@ -513,7 +513,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
513 | /* gap */ | 513 | /* gap */ |
514 | 514 | ||
515 | /* Zero to flush caches. */ | 515 | /* Zero to flush caches. */ |
516 | #define R300_TX_CNTL 0x4100 | 516 | #define R300_TX_INVALTAGS 0x4100 |
517 | #define R300_TX_FLUSH 0x0 | 517 | #define R300_TX_FLUSH 0x0 |
518 | 518 | ||
519 | /* The upper enable bits are guessed, based on fglrx reported limits. */ | 519 | /* The upper enable bits are guessed, based on fglrx reported limits. */ |
@@ -1362,6 +1362,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
1362 | #define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */ | 1362 | #define R300_RB3D_COLORPITCH2 0x4E40 /* GUESS */ |
1363 | #define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */ | 1363 | #define R300_RB3D_COLORPITCH3 0x4E44 /* GUESS */ |
1364 | 1364 | ||
1365 | #define R300_RB3D_AARESOLVE_CTL 0x4E88 | ||
1365 | /* gap */ | 1366 | /* gap */ |
1366 | 1367 | ||
1367 | /* Guess by Vladimir. | 1368 | /* Guess by Vladimir. |
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index f0de81a5689d..3331f88dcfb6 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #define RADEON_FIFO_DEBUG 0 | 40 | #define RADEON_FIFO_DEBUG 0 |
41 | 41 | ||
42 | static int radeon_do_cleanup_cp(struct drm_device * dev); | 42 | static int radeon_do_cleanup_cp(struct drm_device * dev); |
43 | static void radeon_do_cp_start(drm_radeon_private_t * dev_priv); | ||
43 | 44 | ||
44 | static u32 R500_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) | 45 | static u32 R500_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) |
45 | { | 46 | { |
@@ -198,23 +199,8 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv) | |||
198 | DRM_UDELAY(1); | 199 | DRM_UDELAY(1); |
199 | } | 200 | } |
200 | } else { | 201 | } else { |
201 | /* 3D */ | 202 | /* don't flush or purge cache here or lockup */ |
202 | tmp = RADEON_READ(R300_RB3D_DSTCACHE_CTLSTAT); | 203 | return 0; |
203 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; | ||
204 | RADEON_WRITE(R300_RB3D_DSTCACHE_CTLSTAT, tmp); | ||
205 | |||
206 | /* 2D */ | ||
207 | tmp = RADEON_READ(R300_DSTCACHE_CTLSTAT); | ||
208 | tmp |= RADEON_RB3D_DC_FLUSH_ALL; | ||
209 | RADEON_WRITE(R300_DSTCACHE_CTLSTAT, tmp); | ||
210 | |||
211 | for (i = 0; i < dev_priv->usec_timeout; i++) { | ||
212 | if (!(RADEON_READ(R300_DSTCACHE_CTLSTAT) | ||
213 | & RADEON_RB3D_DC_BUSY)) { | ||
214 | return 0; | ||
215 | } | ||
216 | DRM_UDELAY(1); | ||
217 | } | ||
218 | } | 204 | } |
219 | 205 | ||
220 | #if RADEON_FIFO_DEBUG | 206 | #if RADEON_FIFO_DEBUG |
@@ -237,6 +223,9 @@ static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries) | |||
237 | return 0; | 223 | return 0; |
238 | DRM_UDELAY(1); | 224 | DRM_UDELAY(1); |
239 | } | 225 | } |
226 | DRM_INFO("wait for fifo failed status : 0x%08X 0x%08X\n", | ||
227 | RADEON_READ(RADEON_RBBM_STATUS), | ||
228 | RADEON_READ(R300_VAP_CNTL_STATUS)); | ||
240 | 229 | ||
241 | #if RADEON_FIFO_DEBUG | 230 | #if RADEON_FIFO_DEBUG |
242 | DRM_ERROR("failed!\n"); | 231 | DRM_ERROR("failed!\n"); |
@@ -263,6 +252,9 @@ static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) | |||
263 | } | 252 | } |
264 | DRM_UDELAY(1); | 253 | DRM_UDELAY(1); |
265 | } | 254 | } |
255 | DRM_INFO("wait idle failed status : 0x%08X 0x%08X\n", | ||
256 | RADEON_READ(RADEON_RBBM_STATUS), | ||
257 | RADEON_READ(R300_VAP_CNTL_STATUS)); | ||
266 | 258 | ||
267 | #if RADEON_FIFO_DEBUG | 259 | #if RADEON_FIFO_DEBUG |
268 | DRM_ERROR("failed!\n"); | 260 | DRM_ERROR("failed!\n"); |
@@ -443,14 +435,20 @@ static void radeon_do_cp_start(drm_radeon_private_t * dev_priv) | |||
443 | 435 | ||
444 | dev_priv->cp_running = 1; | 436 | dev_priv->cp_running = 1; |
445 | 437 | ||
446 | BEGIN_RING(6); | 438 | BEGIN_RING(8); |
447 | 439 | /* isync can only be written through cp on r5xx write it here */ | |
440 | OUT_RING(CP_PACKET0(RADEON_ISYNC_CNTL, 0)); | ||
441 | OUT_RING(RADEON_ISYNC_ANY2D_IDLE3D | | ||
442 | RADEON_ISYNC_ANY3D_IDLE2D | | ||
443 | RADEON_ISYNC_WAIT_IDLEGUI | | ||
444 | RADEON_ISYNC_CPSCRATCH_IDLEGUI); | ||
448 | RADEON_PURGE_CACHE(); | 445 | RADEON_PURGE_CACHE(); |
449 | RADEON_PURGE_ZCACHE(); | 446 | RADEON_PURGE_ZCACHE(); |
450 | RADEON_WAIT_UNTIL_IDLE(); | 447 | RADEON_WAIT_UNTIL_IDLE(); |
451 | |||
452 | ADVANCE_RING(); | 448 | ADVANCE_RING(); |
453 | COMMIT_RING(); | 449 | COMMIT_RING(); |
450 | |||
451 | dev_priv->track_flush |= RADEON_FLUSH_EMITED | RADEON_PURGE_EMITED; | ||
454 | } | 452 | } |
455 | 453 | ||
456 | /* Reset the Command Processor. This will not flush any pending | 454 | /* Reset the Command Processor. This will not flush any pending |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h index 3f0eca957aa7..099381693175 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.h +++ b/drivers/gpu/drm/radeon/radeon_drv.h | |||
@@ -220,6 +220,9 @@ struct radeon_virt_surface { | |||
220 | struct drm_file *file_priv; | 220 | struct drm_file *file_priv; |
221 | }; | 221 | }; |
222 | 222 | ||
223 | #define RADEON_FLUSH_EMITED (1 < 0) | ||
224 | #define RADEON_PURGE_EMITED (1 < 1) | ||
225 | |||
223 | typedef struct drm_radeon_private { | 226 | typedef struct drm_radeon_private { |
224 | drm_radeon_ring_buffer_t ring; | 227 | drm_radeon_ring_buffer_t ring; |
225 | drm_radeon_sarea_t *sarea_priv; | 228 | drm_radeon_sarea_t *sarea_priv; |
@@ -311,6 +314,7 @@ typedef struct drm_radeon_private { | |||
311 | unsigned long fb_aper_offset; | 314 | unsigned long fb_aper_offset; |
312 | 315 | ||
313 | int num_gb_pipes; | 316 | int num_gb_pipes; |
317 | int track_flush; | ||
314 | } drm_radeon_private_t; | 318 | } drm_radeon_private_t; |
315 | 319 | ||
316 | typedef struct drm_radeon_buf_priv { | 320 | typedef struct drm_radeon_buf_priv { |
@@ -693,7 +697,6 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
693 | #define R300_ZB_ZCACHE_CTLSTAT 0x4f18 | 697 | #define R300_ZB_ZCACHE_CTLSTAT 0x4f18 |
694 | # define R300_ZC_FLUSH (1 << 0) | 698 | # define R300_ZC_FLUSH (1 << 0) |
695 | # define R300_ZC_FREE (1 << 1) | 699 | # define R300_ZC_FREE (1 << 1) |
696 | # define R300_ZC_FLUSH_ALL 0x3 | ||
697 | # define R300_ZC_BUSY (1 << 31) | 700 | # define R300_ZC_BUSY (1 << 31) |
698 | #define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c | 701 | #define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c |
699 | # define RADEON_RB3D_DC_FLUSH (3 << 0) | 702 | # define RADEON_RB3D_DC_FLUSH (3 << 0) |
@@ -701,6 +704,8 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
701 | # define RADEON_RB3D_DC_FLUSH_ALL 0xf | 704 | # define RADEON_RB3D_DC_FLUSH_ALL 0xf |
702 | # define RADEON_RB3D_DC_BUSY (1 << 31) | 705 | # define RADEON_RB3D_DC_BUSY (1 << 31) |
703 | #define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c | 706 | #define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c |
707 | # define R300_RB3D_DC_FLUSH (2 << 0) | ||
708 | # define R300_RB3D_DC_FREE (2 << 2) | ||
704 | # define R300_RB3D_DC_FINISH (1 << 4) | 709 | # define R300_RB3D_DC_FINISH (1 << 4) |
705 | #define RADEON_RB3D_ZSTENCILCNTL 0x1c2c | 710 | #define RADEON_RB3D_ZSTENCILCNTL 0x1c2c |
706 | # define RADEON_Z_TEST_MASK (7 << 4) | 711 | # define RADEON_Z_TEST_MASK (7 << 4) |
@@ -1246,17 +1251,17 @@ do { \ | |||
1246 | OUT_RING(RADEON_RB3D_DC_FLUSH); \ | 1251 | OUT_RING(RADEON_RB3D_DC_FLUSH); \ |
1247 | } else { \ | 1252 | } else { \ |
1248 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1253 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ |
1249 | OUT_RING(RADEON_RB3D_DC_FLUSH); \ | 1254 | OUT_RING(R300_RB3D_DC_FLUSH); \ |
1250 | } \ | 1255 | } \ |
1251 | } while (0) | 1256 | } while (0) |
1252 | 1257 | ||
1253 | #define RADEON_PURGE_CACHE() do { \ | 1258 | #define RADEON_PURGE_CACHE() do { \ |
1254 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ | 1259 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ |
1255 | OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1260 | OUT_RING(CP_PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0)); \ |
1256 | OUT_RING(RADEON_RB3D_DC_FLUSH_ALL); \ | 1261 | OUT_RING(RADEON_RB3D_DC_FLUSH | RADEON_RB3D_DC_FREE); \ |
1257 | } else { \ | 1262 | } else { \ |
1258 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1263 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ |
1259 | OUT_RING(RADEON_RB3D_DC_FLUSH_ALL); \ | 1264 | OUT_RING(R300_RB3D_DC_FLUSH | R300_RB3D_DC_FREE); \ |
1260 | } \ | 1265 | } \ |
1261 | } while (0) | 1266 | } while (0) |
1262 | 1267 | ||
@@ -1273,10 +1278,10 @@ do { \ | |||
1273 | #define RADEON_PURGE_ZCACHE() do { \ | 1278 | #define RADEON_PURGE_ZCACHE() do { \ |
1274 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ | 1279 | if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \ |
1275 | OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \ | 1280 | OUT_RING(CP_PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0)); \ |
1276 | OUT_RING(RADEON_RB3D_ZC_FLUSH_ALL); \ | 1281 | OUT_RING(RADEON_RB3D_ZC_FLUSH | RADEON_RB3D_ZC_FREE); \ |
1277 | } else { \ | 1282 | } else { \ |
1278 | OUT_RING(CP_PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); \ | 1283 | OUT_RING(CP_PACKET0(R300_ZB_ZCACHE_CTLSTAT, 0)); \ |
1279 | OUT_RING(R300_ZC_FLUSH_ALL); \ | 1284 | OUT_RING(R300_ZC_FLUSH | R300_ZC_FREE); \ |
1280 | } \ | 1285 | } \ |
1281 | } while (0) | 1286 | } while (0) |
1282 | 1287 | ||
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index b9f90a5d3d4d..213437d13154 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -208,7 +208,7 @@ struct e1000_option { | |||
208 | } r; | 208 | } r; |
209 | struct { /* list_option info */ | 209 | struct { /* list_option info */ |
210 | int nr; | 210 | int nr; |
211 | struct e1000_opt_list { int i; char *str; } *p; | 211 | const struct e1000_opt_list { int i; char *str; } *p; |
212 | } l; | 212 | } l; |
213 | } arg; | 213 | } arg; |
214 | }; | 214 | }; |
@@ -242,7 +242,7 @@ static int __devinit e1000_validate_option(unsigned int *value, | |||
242 | break; | 242 | break; |
243 | case list_option: { | 243 | case list_option: { |
244 | int i; | 244 | int i; |
245 | struct e1000_opt_list *ent; | 245 | const struct e1000_opt_list *ent; |
246 | 246 | ||
247 | for (i = 0; i < opt->arg.l.nr; i++) { | 247 | for (i = 0; i < opt->arg.l.nr; i++) { |
248 | ent = &opt->arg.l.p[i]; | 248 | ent = &opt->arg.l.p[i]; |
@@ -279,7 +279,9 @@ static void e1000_check_copper_options(struct e1000_adapter *adapter); | |||
279 | 279 | ||
280 | void __devinit e1000_check_options(struct e1000_adapter *adapter) | 280 | void __devinit e1000_check_options(struct e1000_adapter *adapter) |
281 | { | 281 | { |
282 | struct e1000_option opt; | ||
282 | int bd = adapter->bd_number; | 283 | int bd = adapter->bd_number; |
284 | |||
283 | if (bd >= E1000_MAX_NIC) { | 285 | if (bd >= E1000_MAX_NIC) { |
284 | DPRINTK(PROBE, NOTICE, | 286 | DPRINTK(PROBE, NOTICE, |
285 | "Warning: no configuration for board #%i\n", bd); | 287 | "Warning: no configuration for board #%i\n", bd); |
@@ -287,19 +289,21 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
287 | } | 289 | } |
288 | 290 | ||
289 | { /* Transmit Descriptor Count */ | 291 | { /* Transmit Descriptor Count */ |
290 | struct e1000_option opt = { | 292 | struct e1000_tx_ring *tx_ring = adapter->tx_ring; |
293 | int i; | ||
294 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
295 | |||
296 | opt = (struct e1000_option) { | ||
291 | .type = range_option, | 297 | .type = range_option, |
292 | .name = "Transmit Descriptors", | 298 | .name = "Transmit Descriptors", |
293 | .err = "using default of " | 299 | .err = "using default of " |
294 | __MODULE_STRING(E1000_DEFAULT_TXD), | 300 | __MODULE_STRING(E1000_DEFAULT_TXD), |
295 | .def = E1000_DEFAULT_TXD, | 301 | .def = E1000_DEFAULT_TXD, |
296 | .arg = { .r = { .min = E1000_MIN_TXD }} | 302 | .arg = { .r = { |
303 | .min = E1000_MIN_TXD, | ||
304 | .max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD | ||
305 | }} | ||
297 | }; | 306 | }; |
298 | struct e1000_tx_ring *tx_ring = adapter->tx_ring; | ||
299 | int i; | ||
300 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
301 | opt.arg.r.max = mac_type < e1000_82544 ? | ||
302 | E1000_MAX_TXD : E1000_MAX_82544_TXD; | ||
303 | 307 | ||
304 | if (num_TxDescriptors > bd) { | 308 | if (num_TxDescriptors > bd) { |
305 | tx_ring->count = TxDescriptors[bd]; | 309 | tx_ring->count = TxDescriptors[bd]; |
@@ -313,19 +317,21 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
313 | tx_ring[i].count = tx_ring->count; | 317 | tx_ring[i].count = tx_ring->count; |
314 | } | 318 | } |
315 | { /* Receive Descriptor Count */ | 319 | { /* Receive Descriptor Count */ |
316 | struct e1000_option opt = { | 320 | struct e1000_rx_ring *rx_ring = adapter->rx_ring; |
321 | int i; | ||
322 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
323 | |||
324 | opt = (struct e1000_option) { | ||
317 | .type = range_option, | 325 | .type = range_option, |
318 | .name = "Receive Descriptors", | 326 | .name = "Receive Descriptors", |
319 | .err = "using default of " | 327 | .err = "using default of " |
320 | __MODULE_STRING(E1000_DEFAULT_RXD), | 328 | __MODULE_STRING(E1000_DEFAULT_RXD), |
321 | .def = E1000_DEFAULT_RXD, | 329 | .def = E1000_DEFAULT_RXD, |
322 | .arg = { .r = { .min = E1000_MIN_RXD }} | 330 | .arg = { .r = { |
331 | .min = E1000_MIN_RXD, | ||
332 | .max = mac_type < e1000_82544 ? E1000_MAX_RXD : E1000_MAX_82544_RXD | ||
333 | }} | ||
323 | }; | 334 | }; |
324 | struct e1000_rx_ring *rx_ring = adapter->rx_ring; | ||
325 | int i; | ||
326 | e1000_mac_type mac_type = adapter->hw.mac_type; | ||
327 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : | ||
328 | E1000_MAX_82544_RXD; | ||
329 | 335 | ||
330 | if (num_RxDescriptors > bd) { | 336 | if (num_RxDescriptors > bd) { |
331 | rx_ring->count = RxDescriptors[bd]; | 337 | rx_ring->count = RxDescriptors[bd]; |
@@ -339,7 +345,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
339 | rx_ring[i].count = rx_ring->count; | 345 | rx_ring[i].count = rx_ring->count; |
340 | } | 346 | } |
341 | { /* Checksum Offload Enable/Disable */ | 347 | { /* Checksum Offload Enable/Disable */ |
342 | struct e1000_option opt = { | 348 | opt = (struct e1000_option) { |
343 | .type = enable_option, | 349 | .type = enable_option, |
344 | .name = "Checksum Offload", | 350 | .name = "Checksum Offload", |
345 | .err = "defaulting to Enabled", | 351 | .err = "defaulting to Enabled", |
@@ -363,7 +369,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
363 | { E1000_FC_FULL, "Flow Control Enabled" }, | 369 | { E1000_FC_FULL, "Flow Control Enabled" }, |
364 | { E1000_FC_DEFAULT, "Flow Control Hardware Default" }}; | 370 | { E1000_FC_DEFAULT, "Flow Control Hardware Default" }}; |
365 | 371 | ||
366 | struct e1000_option opt = { | 372 | opt = (struct e1000_option) { |
367 | .type = list_option, | 373 | .type = list_option, |
368 | .name = "Flow Control", | 374 | .name = "Flow Control", |
369 | .err = "reading default settings from EEPROM", | 375 | .err = "reading default settings from EEPROM", |
@@ -381,7 +387,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
381 | } | 387 | } |
382 | } | 388 | } |
383 | { /* Transmit Interrupt Delay */ | 389 | { /* Transmit Interrupt Delay */ |
384 | struct e1000_option opt = { | 390 | opt = (struct e1000_option) { |
385 | .type = range_option, | 391 | .type = range_option, |
386 | .name = "Transmit Interrupt Delay", | 392 | .name = "Transmit Interrupt Delay", |
387 | .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), | 393 | .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), |
@@ -399,7 +405,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
399 | } | 405 | } |
400 | } | 406 | } |
401 | { /* Transmit Absolute Interrupt Delay */ | 407 | { /* Transmit Absolute Interrupt Delay */ |
402 | struct e1000_option opt = { | 408 | opt = (struct e1000_option) { |
403 | .type = range_option, | 409 | .type = range_option, |
404 | .name = "Transmit Absolute Interrupt Delay", | 410 | .name = "Transmit Absolute Interrupt Delay", |
405 | .err = "using default of " __MODULE_STRING(DEFAULT_TADV), | 411 | .err = "using default of " __MODULE_STRING(DEFAULT_TADV), |
@@ -417,7 +423,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
417 | } | 423 | } |
418 | } | 424 | } |
419 | { /* Receive Interrupt Delay */ | 425 | { /* Receive Interrupt Delay */ |
420 | struct e1000_option opt = { | 426 | opt = (struct e1000_option) { |
421 | .type = range_option, | 427 | .type = range_option, |
422 | .name = "Receive Interrupt Delay", | 428 | .name = "Receive Interrupt Delay", |
423 | .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), | 429 | .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), |
@@ -435,7 +441,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
435 | } | 441 | } |
436 | } | 442 | } |
437 | { /* Receive Absolute Interrupt Delay */ | 443 | { /* Receive Absolute Interrupt Delay */ |
438 | struct e1000_option opt = { | 444 | opt = (struct e1000_option) { |
439 | .type = range_option, | 445 | .type = range_option, |
440 | .name = "Receive Absolute Interrupt Delay", | 446 | .name = "Receive Absolute Interrupt Delay", |
441 | .err = "using default of " __MODULE_STRING(DEFAULT_RADV), | 447 | .err = "using default of " __MODULE_STRING(DEFAULT_RADV), |
@@ -453,7 +459,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
453 | } | 459 | } |
454 | } | 460 | } |
455 | { /* Interrupt Throttling Rate */ | 461 | { /* Interrupt Throttling Rate */ |
456 | struct e1000_option opt = { | 462 | opt = (struct e1000_option) { |
457 | .type = range_option, | 463 | .type = range_option, |
458 | .name = "Interrupt Throttling Rate (ints/sec)", | 464 | .name = "Interrupt Throttling Rate (ints/sec)", |
459 | .err = "using default of " __MODULE_STRING(DEFAULT_ITR), | 465 | .err = "using default of " __MODULE_STRING(DEFAULT_ITR), |
@@ -497,7 +503,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
497 | } | 503 | } |
498 | } | 504 | } |
499 | { /* Smart Power Down */ | 505 | { /* Smart Power Down */ |
500 | struct e1000_option opt = { | 506 | opt = (struct e1000_option) { |
501 | .type = enable_option, | 507 | .type = enable_option, |
502 | .name = "PHY Smart Power Down", | 508 | .name = "PHY Smart Power Down", |
503 | .err = "defaulting to Disabled", | 509 | .err = "defaulting to Disabled", |
@@ -513,7 +519,7 @@ void __devinit e1000_check_options(struct e1000_adapter *adapter) | |||
513 | } | 519 | } |
514 | } | 520 | } |
515 | { /* Kumeran Lock Loss Workaround */ | 521 | { /* Kumeran Lock Loss Workaround */ |
516 | struct e1000_option opt = { | 522 | opt = (struct e1000_option) { |
517 | .type = enable_option, | 523 | .type = enable_option, |
518 | .name = "Kumeran Lock Loss Workaround", | 524 | .name = "Kumeran Lock Loss Workaround", |
519 | .err = "defaulting to Enabled", | 525 | .err = "defaulting to Enabled", |
@@ -578,16 +584,18 @@ static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter) | |||
578 | 584 | ||
579 | static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | 585 | static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) |
580 | { | 586 | { |
587 | struct e1000_option opt; | ||
581 | unsigned int speed, dplx, an; | 588 | unsigned int speed, dplx, an; |
582 | int bd = adapter->bd_number; | 589 | int bd = adapter->bd_number; |
583 | 590 | ||
584 | { /* Speed */ | 591 | { /* Speed */ |
585 | struct e1000_opt_list speed_list[] = {{ 0, "" }, | 592 | static const struct e1000_opt_list speed_list[] = { |
586 | { SPEED_10, "" }, | 593 | { 0, "" }, |
587 | { SPEED_100, "" }, | 594 | { SPEED_10, "" }, |
588 | { SPEED_1000, "" }}; | 595 | { SPEED_100, "" }, |
596 | { SPEED_1000, "" }}; | ||
589 | 597 | ||
590 | struct e1000_option opt = { | 598 | opt = (struct e1000_option) { |
591 | .type = list_option, | 599 | .type = list_option, |
592 | .name = "Speed", | 600 | .name = "Speed", |
593 | .err = "parameter ignored", | 601 | .err = "parameter ignored", |
@@ -604,11 +612,12 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | |||
604 | } | 612 | } |
605 | } | 613 | } |
606 | { /* Duplex */ | 614 | { /* Duplex */ |
607 | struct e1000_opt_list dplx_list[] = {{ 0, "" }, | 615 | static const struct e1000_opt_list dplx_list[] = { |
608 | { HALF_DUPLEX, "" }, | 616 | { 0, "" }, |
609 | { FULL_DUPLEX, "" }}; | 617 | { HALF_DUPLEX, "" }, |
618 | { FULL_DUPLEX, "" }}; | ||
610 | 619 | ||
611 | struct e1000_option opt = { | 620 | opt = (struct e1000_option) { |
612 | .type = list_option, | 621 | .type = list_option, |
613 | .name = "Duplex", | 622 | .name = "Duplex", |
614 | .err = "parameter ignored", | 623 | .err = "parameter ignored", |
@@ -637,7 +646,7 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | |||
637 | "parameter ignored\n"); | 646 | "parameter ignored\n"); |
638 | adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; | 647 | adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; |
639 | } else { /* Autoneg */ | 648 | } else { /* Autoneg */ |
640 | struct e1000_opt_list an_list[] = | 649 | static const struct e1000_opt_list an_list[] = |
641 | #define AA "AutoNeg advertising " | 650 | #define AA "AutoNeg advertising " |
642 | {{ 0x01, AA "10/HD" }, | 651 | {{ 0x01, AA "10/HD" }, |
643 | { 0x02, AA "10/FD" }, | 652 | { 0x02, AA "10/FD" }, |
@@ -671,7 +680,7 @@ static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) | |||
671 | { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, | 680 | { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, |
672 | { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; | 681 | { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; |
673 | 682 | ||
674 | struct e1000_option opt = { | 683 | opt = (struct e1000_option) { |
675 | .type = list_option, | 684 | .type = list_option, |
676 | .name = "AutoNeg", | 685 | .name = "AutoNeg", |
677 | .err = "parameter ignored", | 686 | .err = "parameter ignored", |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index db85f1fb131e..711b3004b3e6 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -384,9 +384,10 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char | |||
384 | * get minor, add to list | 384 | * get minor, add to list |
385 | */ | 385 | */ |
386 | down_write(&dcssblk_devices_sem); | 386 | down_write(&dcssblk_devices_sem); |
387 | if (dcssblk_get_segment_by_name(local_buf)) { | 387 | if (dcssblk_get_device_by_name(local_buf)) { |
388 | up_write(&dcssblk_devices_sem); | ||
388 | rc = -EEXIST; | 389 | rc = -EEXIST; |
389 | goto release_gd; | 390 | goto unload_seg; |
390 | } | 391 | } |
391 | rc = dcssblk_assign_free_minor(dev_info); | 392 | rc = dcssblk_assign_free_minor(dev_info); |
392 | if (rc) { | 393 | if (rc) { |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 3d36270a8b4d..661f9f21650a 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -217,6 +217,18 @@ static int sg_last_dev(void); | |||
217 | #define SZ_SG_IOVEC sizeof(sg_iovec_t) | 217 | #define SZ_SG_IOVEC sizeof(sg_iovec_t) |
218 | #define SZ_SG_REQ_INFO sizeof(sg_req_info_t) | 218 | #define SZ_SG_REQ_INFO sizeof(sg_req_info_t) |
219 | 219 | ||
220 | static int sg_allow_access(struct file *filp, unsigned char *cmd) | ||
221 | { | ||
222 | struct sg_fd *sfp = (struct sg_fd *)filp->private_data; | ||
223 | struct request_queue *q = sfp->parentdp->device->request_queue; | ||
224 | |||
225 | if (sfp->parentdp->device->type == TYPE_SCANNER) | ||
226 | return 0; | ||
227 | |||
228 | return blk_verify_command(&q->cmd_filter, | ||
229 | cmd, filp->f_mode & FMODE_WRITE); | ||
230 | } | ||
231 | |||
220 | static int | 232 | static int |
221 | sg_open(struct inode *inode, struct file *filp) | 233 | sg_open(struct inode *inode, struct file *filp) |
222 | { | 234 | { |
@@ -689,7 +701,7 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf, | |||
689 | sg_remove_request(sfp, srp); | 701 | sg_remove_request(sfp, srp); |
690 | return -EFAULT; | 702 | return -EFAULT; |
691 | } | 703 | } |
692 | if (read_only && !blk_verify_command(file, cmnd)) { | 704 | if (read_only && sg_allow_access(file, cmnd)) { |
693 | sg_remove_request(sfp, srp); | 705 | sg_remove_request(sfp, srp); |
694 | return -EPERM; | 706 | return -EPERM; |
695 | } | 707 | } |
@@ -793,6 +805,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
793 | 805 | ||
794 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) | 806 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) |
795 | return -ENXIO; | 807 | return -ENXIO; |
808 | |||
796 | SCSI_LOG_TIMEOUT(3, printk("sg_ioctl: %s, cmd=0x%x\n", | 809 | SCSI_LOG_TIMEOUT(3, printk("sg_ioctl: %s, cmd=0x%x\n", |
797 | sdp->disk->disk_name, (int) cmd_in)); | 810 | sdp->disk->disk_name, (int) cmd_in)); |
798 | read_only = (O_RDWR != (filp->f_flags & O_ACCMODE)); | 811 | read_only = (O_RDWR != (filp->f_flags & O_ACCMODE)); |
@@ -1061,7 +1074,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
1061 | 1074 | ||
1062 | if (copy_from_user(&opcode, siocp->data, 1)) | 1075 | if (copy_from_user(&opcode, siocp->data, 1)) |
1063 | return -EFAULT; | 1076 | return -EFAULT; |
1064 | if (!blk_verify_command(filp, &opcode)) | 1077 | if (sg_allow_access(filp, &opcode)) |
1065 | return -EPERM; | 1078 | return -EPERM; |
1066 | } | 1079 | } |
1067 | return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p); | 1080 | return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p); |
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 88e3787c6ea9..e298fe194093 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
@@ -119,6 +119,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) | |||
119 | 119 | ||
120 | const struct file_operations v9fs_dir_operations = { | 120 | const struct file_operations v9fs_dir_operations = { |
121 | .read = generic_read_dir, | 121 | .read = generic_read_dir, |
122 | .llseek = generic_file_llseek, | ||
122 | .readdir = v9fs_dir_readdir, | 123 | .readdir = v9fs_dir_readdir, |
123 | .open = v9fs_file_open, | 124 | .open = v9fs_file_open, |
124 | .release = v9fs_dir_release, | 125 | .release = v9fs_dir_release, |
diff --git a/fs/Kconfig b/fs/Kconfig index f0427105a619..abccb5dab9a8 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -1930,6 +1930,16 @@ config CIFS_WEAK_PW_HASH | |||
1930 | 1930 | ||
1931 | If unsure, say N. | 1931 | If unsure, say N. |
1932 | 1932 | ||
1933 | config CIFS_UPCALL | ||
1934 | bool "Kerberos/SPNEGO advanced session setup" | ||
1935 | depends on CIFS && KEYS | ||
1936 | help | ||
1937 | Enables an upcall mechanism for CIFS which accesses | ||
1938 | userspace helper utilities to provide SPNEGO packaged (RFC 4178) | ||
1939 | Kerberos tickets which are needed to mount to certain secure servers | ||
1940 | (for which more secure Kerberos authentication is required). If | ||
1941 | unsure, say N. | ||
1942 | |||
1933 | config CIFS_XATTR | 1943 | config CIFS_XATTR |
1934 | bool "CIFS extended attributes" | 1944 | bool "CIFS extended attributes" |
1935 | depends on CIFS | 1945 | depends on CIFS |
@@ -1982,16 +1992,6 @@ config CIFS_EXPERIMENTAL | |||
1982 | (which is disabled by default). See the file fs/cifs/README | 1992 | (which is disabled by default). See the file fs/cifs/README |
1983 | for more details. If unsure, say N. | 1993 | for more details. If unsure, say N. |
1984 | 1994 | ||
1985 | config CIFS_UPCALL | ||
1986 | bool "Kerberos/SPNEGO advanced session setup (EXPERIMENTAL)" | ||
1987 | depends on KEYS | ||
1988 | help | ||
1989 | Enables an upcall mechanism for CIFS which accesses | ||
1990 | userspace helper utilities to provide SPNEGO packaged (RFC 4178) | ||
1991 | Kerberos tickets which are needed to mount to certain secure servers | ||
1992 | (for which more secure Kerberos authentication is required). If | ||
1993 | unsure, say N. | ||
1994 | |||
1995 | config CIFS_DFS_UPCALL | 1995 | config CIFS_DFS_UPCALL |
1996 | bool "DFS feature support (EXPERIMENTAL)" | 1996 | bool "DFS feature support (EXPERIMENTAL)" |
1997 | depends on CIFS_EXPERIMENTAL | 1997 | depends on CIFS_EXPERIMENTAL |
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index fc1a8dc64d78..85a30e929800 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c | |||
@@ -197,6 +197,7 @@ out: | |||
197 | 197 | ||
198 | const struct file_operations adfs_dir_operations = { | 198 | const struct file_operations adfs_dir_operations = { |
199 | .read = generic_read_dir, | 199 | .read = generic_read_dir, |
200 | .llseek = generic_file_llseek, | ||
200 | .readdir = adfs_readdir, | 201 | .readdir = adfs_readdir, |
201 | .fsync = file_fsync, | 202 | .fsync = file_fsync, |
202 | }; | 203 | }; |
diff --git a/fs/affs/dir.c b/fs/affs/dir.c index 6e3f282424b0..7b36904dbeac 100644 --- a/fs/affs/dir.c +++ b/fs/affs/dir.c | |||
@@ -19,6 +19,7 @@ static int affs_readdir(struct file *, void *, filldir_t); | |||
19 | 19 | ||
20 | const struct file_operations affs_dir_operations = { | 20 | const struct file_operations affs_dir_operations = { |
21 | .read = generic_read_dir, | 21 | .read = generic_read_dir, |
22 | .llseek = generic_file_llseek, | ||
22 | .readdir = affs_readdir, | 23 | .readdir = affs_readdir, |
23 | .fsync = file_fsync, | 24 | .fsync = file_fsync, |
24 | }; | 25 | }; |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index bcfb2dc0a61b..2a41c2a7fc52 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -36,6 +36,7 @@ const struct file_operations autofs4_root_operations = { | |||
36 | .release = dcache_dir_close, | 36 | .release = dcache_dir_close, |
37 | .read = generic_read_dir, | 37 | .read = generic_read_dir, |
38 | .readdir = dcache_readdir, | 38 | .readdir = dcache_readdir, |
39 | .llseek = dcache_dir_lseek, | ||
39 | .ioctl = autofs4_root_ioctl, | 40 | .ioctl = autofs4_root_ioctl, |
40 | }; | 41 | }; |
41 | 42 | ||
@@ -44,6 +45,7 @@ const struct file_operations autofs4_dir_operations = { | |||
44 | .release = dcache_dir_close, | 45 | .release = dcache_dir_close, |
45 | .read = generic_read_dir, | 46 | .read = generic_read_dir, |
46 | .readdir = dcache_readdir, | 47 | .readdir = dcache_readdir, |
48 | .llseek = dcache_dir_lseek, | ||
47 | }; | 49 | }; |
48 | 50 | ||
49 | const struct inode_operations autofs4_indirect_root_inode_operations = { | 51 | const struct inode_operations autofs4_indirect_root_inode_operations = { |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 02c6e62b72f8..740f53672a8a 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -66,6 +66,7 @@ static struct kmem_cache *befs_inode_cachep; | |||
66 | static const struct file_operations befs_dir_operations = { | 66 | static const struct file_operations befs_dir_operations = { |
67 | .read = generic_read_dir, | 67 | .read = generic_read_dir, |
68 | .readdir = befs_readdir, | 68 | .readdir = befs_readdir, |
69 | .llseek = generic_file_llseek, | ||
69 | }; | 70 | }; |
70 | 71 | ||
71 | static const struct inode_operations befs_dir_inode_operations = { | 72 | static const struct inode_operations befs_dir_inode_operations = { |
@@ -469,20 +469,21 @@ static void bio_free_map_data(struct bio_map_data *bmd) | |||
469 | kfree(bmd); | 469 | kfree(bmd); |
470 | } | 470 | } |
471 | 471 | ||
472 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count) | 472 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, |
473 | gfp_t gfp_mask) | ||
473 | { | 474 | { |
474 | struct bio_map_data *bmd = kmalloc(sizeof(*bmd), GFP_KERNEL); | 475 | struct bio_map_data *bmd = kmalloc(sizeof(*bmd), gfp_mask); |
475 | 476 | ||
476 | if (!bmd) | 477 | if (!bmd) |
477 | return NULL; | 478 | return NULL; |
478 | 479 | ||
479 | bmd->iovecs = kmalloc(sizeof(struct bio_vec) * nr_segs, GFP_KERNEL); | 480 | bmd->iovecs = kmalloc(sizeof(struct bio_vec) * nr_segs, gfp_mask); |
480 | if (!bmd->iovecs) { | 481 | if (!bmd->iovecs) { |
481 | kfree(bmd); | 482 | kfree(bmd); |
482 | return NULL; | 483 | return NULL; |
483 | } | 484 | } |
484 | 485 | ||
485 | bmd->sgvecs = kmalloc(sizeof(struct sg_iovec) * iov_count, GFP_KERNEL); | 486 | bmd->sgvecs = kmalloc(sizeof(struct sg_iovec) * iov_count, gfp_mask); |
486 | if (bmd->sgvecs) | 487 | if (bmd->sgvecs) |
487 | return bmd; | 488 | return bmd; |
488 | 489 | ||
@@ -491,8 +492,8 @@ static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count) | |||
491 | return NULL; | 492 | return NULL; |
492 | } | 493 | } |
493 | 494 | ||
494 | static int __bio_copy_iov(struct bio *bio, struct sg_iovec *iov, int iov_count, | 495 | static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, |
495 | int uncopy) | 496 | struct sg_iovec *iov, int iov_count, int uncopy) |
496 | { | 497 | { |
497 | int ret = 0, i; | 498 | int ret = 0, i; |
498 | struct bio_vec *bvec; | 499 | struct bio_vec *bvec; |
@@ -502,7 +503,7 @@ static int __bio_copy_iov(struct bio *bio, struct sg_iovec *iov, int iov_count, | |||
502 | 503 | ||
503 | __bio_for_each_segment(bvec, bio, i, 0) { | 504 | __bio_for_each_segment(bvec, bio, i, 0) { |
504 | char *bv_addr = page_address(bvec->bv_page); | 505 | char *bv_addr = page_address(bvec->bv_page); |
505 | unsigned int bv_len = bvec->bv_len; | 506 | unsigned int bv_len = iovecs[i].bv_len; |
506 | 507 | ||
507 | while (bv_len && iov_idx < iov_count) { | 508 | while (bv_len && iov_idx < iov_count) { |
508 | unsigned int bytes; | 509 | unsigned int bytes; |
@@ -554,7 +555,7 @@ int bio_uncopy_user(struct bio *bio) | |||
554 | struct bio_map_data *bmd = bio->bi_private; | 555 | struct bio_map_data *bmd = bio->bi_private; |
555 | int ret; | 556 | int ret; |
556 | 557 | ||
557 | ret = __bio_copy_iov(bio, bmd->sgvecs, bmd->nr_sgvecs, 1); | 558 | ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs, bmd->nr_sgvecs, 1); |
558 | 559 | ||
559 | bio_free_map_data(bmd); | 560 | bio_free_map_data(bmd); |
560 | bio_put(bio); | 561 | bio_put(bio); |
@@ -596,7 +597,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q, struct sg_iovec *iov, | |||
596 | len += iov[i].iov_len; | 597 | len += iov[i].iov_len; |
597 | } | 598 | } |
598 | 599 | ||
599 | bmd = bio_alloc_map_data(nr_pages, iov_count); | 600 | bmd = bio_alloc_map_data(nr_pages, iov_count, GFP_KERNEL); |
600 | if (!bmd) | 601 | if (!bmd) |
601 | return ERR_PTR(-ENOMEM); | 602 | return ERR_PTR(-ENOMEM); |
602 | 603 | ||
@@ -633,7 +634,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q, struct sg_iovec *iov, | |||
633 | * success | 634 | * success |
634 | */ | 635 | */ |
635 | if (!write_to_vm) { | 636 | if (!write_to_vm) { |
636 | ret = __bio_copy_iov(bio, iov, iov_count, 0); | 637 | ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0); |
637 | if (ret) | 638 | if (ret) |
638 | goto cleanup; | 639 | goto cleanup; |
639 | } | 640 | } |
@@ -942,19 +943,22 @@ static void bio_copy_kern_endio(struct bio *bio, int err) | |||
942 | { | 943 | { |
943 | struct bio_vec *bvec; | 944 | struct bio_vec *bvec; |
944 | const int read = bio_data_dir(bio) == READ; | 945 | const int read = bio_data_dir(bio) == READ; |
945 | char *p = bio->bi_private; | 946 | struct bio_map_data *bmd = bio->bi_private; |
946 | int i; | 947 | int i; |
948 | char *p = bmd->sgvecs[0].iov_base; | ||
947 | 949 | ||
948 | __bio_for_each_segment(bvec, bio, i, 0) { | 950 | __bio_for_each_segment(bvec, bio, i, 0) { |
949 | char *addr = page_address(bvec->bv_page); | 951 | char *addr = page_address(bvec->bv_page); |
952 | int len = bmd->iovecs[i].bv_len; | ||
950 | 953 | ||
951 | if (read && !err) | 954 | if (read && !err) |
952 | memcpy(p, addr, bvec->bv_len); | 955 | memcpy(p, addr, len); |
953 | 956 | ||
954 | __free_page(bvec->bv_page); | 957 | __free_page(bvec->bv_page); |
955 | p += bvec->bv_len; | 958 | p += len; |
956 | } | 959 | } |
957 | 960 | ||
961 | bio_free_map_data(bmd); | ||
958 | bio_put(bio); | 962 | bio_put(bio); |
959 | } | 963 | } |
960 | 964 | ||
@@ -978,11 +982,21 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len, | |||
978 | const int nr_pages = end - start; | 982 | const int nr_pages = end - start; |
979 | struct bio *bio; | 983 | struct bio *bio; |
980 | struct bio_vec *bvec; | 984 | struct bio_vec *bvec; |
985 | struct bio_map_data *bmd; | ||
981 | int i, ret; | 986 | int i, ret; |
987 | struct sg_iovec iov; | ||
988 | |||
989 | iov.iov_base = data; | ||
990 | iov.iov_len = len; | ||
991 | |||
992 | bmd = bio_alloc_map_data(nr_pages, 1, gfp_mask); | ||
993 | if (!bmd) | ||
994 | return ERR_PTR(-ENOMEM); | ||
982 | 995 | ||
996 | ret = -ENOMEM; | ||
983 | bio = bio_alloc(gfp_mask, nr_pages); | 997 | bio = bio_alloc(gfp_mask, nr_pages); |
984 | if (!bio) | 998 | if (!bio) |
985 | return ERR_PTR(-ENOMEM); | 999 | goto out_bmd; |
986 | 1000 | ||
987 | while (len) { | 1001 | while (len) { |
988 | struct page *page; | 1002 | struct page *page; |
@@ -1016,14 +1030,18 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len, | |||
1016 | } | 1030 | } |
1017 | } | 1031 | } |
1018 | 1032 | ||
1019 | bio->bi_private = data; | 1033 | bio->bi_private = bmd; |
1020 | bio->bi_end_io = bio_copy_kern_endio; | 1034 | bio->bi_end_io = bio_copy_kern_endio; |
1035 | |||
1036 | bio_set_map_data(bmd, bio, &iov, 1); | ||
1021 | return bio; | 1037 | return bio; |
1022 | cleanup: | 1038 | cleanup: |
1023 | bio_for_each_segment(bvec, bio, i) | 1039 | bio_for_each_segment(bvec, bio, i) |
1024 | __free_page(bvec->bv_page); | 1040 | __free_page(bvec->bv_page); |
1025 | 1041 | ||
1026 | bio_put(bio); | 1042 | bio_put(bio); |
1043 | out_bmd: | ||
1044 | bio_free_map_data(bmd); | ||
1027 | 1045 | ||
1028 | return ERR_PTR(ret); | 1046 | return ERR_PTR(ret); |
1029 | } | 1047 | } |
diff --git a/fs/buffer.c b/fs/buffer.c index 38653e36e225..ac78d4c19b3b 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2926,14 +2926,17 @@ int submit_bh(int rw, struct buffer_head * bh) | |||
2926 | BUG_ON(!buffer_mapped(bh)); | 2926 | BUG_ON(!buffer_mapped(bh)); |
2927 | BUG_ON(!bh->b_end_io); | 2927 | BUG_ON(!bh->b_end_io); |
2928 | 2928 | ||
2929 | if (buffer_ordered(bh) && (rw == WRITE)) | 2929 | /* |
2930 | rw = WRITE_BARRIER; | 2930 | * Mask in barrier bit for a write (could be either a WRITE or a |
2931 | * WRITE_SYNC | ||
2932 | */ | ||
2933 | if (buffer_ordered(bh) && (rw & WRITE)) | ||
2934 | rw |= WRITE_BARRIER; | ||
2931 | 2935 | ||
2932 | /* | 2936 | /* |
2933 | * Only clear out a write error when rewriting, should this | 2937 | * Only clear out a write error when rewriting |
2934 | * include WRITE_SYNC as well? | ||
2935 | */ | 2938 | */ |
2936 | if (test_set_buffer_req(bh) && (rw == WRITE || rw == WRITE_BARRIER)) | 2939 | if (test_set_buffer_req(bh) && (rw & WRITE)) |
2937 | clear_buffer_write_io_error(bh); | 2940 | clear_buffer_write_io_error(bh); |
2938 | 2941 | ||
2939 | /* | 2942 | /* |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 526041a52d35..f9e4ad97a79e 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -8,7 +8,8 @@ architectures. Fix problems with preserving timestamps on copying open | |||
8 | files (e.g. "cp -a") to Windows servers. For mkdir and create honor setgid bit | 8 | files (e.g. "cp -a") to Windows servers. For mkdir and create honor setgid bit |
9 | on parent directory when server supports Unix Extensions but not POSIX | 9 | on parent directory when server supports Unix Extensions but not POSIX |
10 | create. Update cifs.upcall version to handle new Kerberos sec flags | 10 | create. Update cifs.upcall version to handle new Kerberos sec flags |
11 | (this requires update of cifs.upcall program from Samba). | 11 | (this requires update of cifs.upcall program from Samba). Fix memory leak |
12 | on dns_upcall (resolving DFS referralls). | ||
12 | 13 | ||
13 | Version 1.53 | 14 | Version 1.53 |
14 | ------------ | 15 | ------------ |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index f730ef35499e..a2e0673e1b08 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -47,11 +47,18 @@ static int dns_resolver_instantiate(struct key *key, const void *data, | |||
47 | return rc; | 47 | return rc; |
48 | } | 48 | } |
49 | 49 | ||
50 | static void | ||
51 | dns_resolver_destroy(struct key *key) | ||
52 | { | ||
53 | kfree(key->payload.data); | ||
54 | } | ||
55 | |||
50 | struct key_type key_type_dns_resolver = { | 56 | struct key_type key_type_dns_resolver = { |
51 | .name = "dns_resolver", | 57 | .name = "dns_resolver", |
52 | .def_datalen = sizeof(struct in_addr), | 58 | .def_datalen = sizeof(struct in_addr), |
53 | .describe = user_describe, | 59 | .describe = user_describe, |
54 | .instantiate = dns_resolver_instantiate, | 60 | .instantiate = dns_resolver_instantiate, |
61 | .destroy = dns_resolver_destroy, | ||
55 | .match = user_match, | 62 | .match = user_match, |
56 | }; | 63 | }; |
57 | 64 | ||
diff --git a/fs/compat.c b/fs/compat.c index c9d1472e65c5..075d0509970d 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -792,8 +792,10 @@ static int compat_fillonedir(void *__buf, const char *name, int namlen, | |||
792 | if (buf->result) | 792 | if (buf->result) |
793 | return -EINVAL; | 793 | return -EINVAL; |
794 | d_ino = ino; | 794 | d_ino = ino; |
795 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | 795 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { |
796 | buf->result = -EOVERFLOW; | ||
796 | return -EOVERFLOW; | 797 | return -EOVERFLOW; |
798 | } | ||
797 | buf->result++; | 799 | buf->result++; |
798 | dirent = buf->dirent; | 800 | dirent = buf->dirent; |
799 | if (!access_ok(VERIFY_WRITE, dirent, | 801 | if (!access_ok(VERIFY_WRITE, dirent, |
@@ -862,8 +864,10 @@ static int compat_filldir(void *__buf, const char *name, int namlen, | |||
862 | if (reclen > buf->count) | 864 | if (reclen > buf->count) |
863 | return -EINVAL; | 865 | return -EINVAL; |
864 | d_ino = ino; | 866 | d_ino = ino; |
865 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | 867 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { |
868 | buf->error = -EOVERFLOW; | ||
866 | return -EOVERFLOW; | 869 | return -EOVERFLOW; |
870 | } | ||
867 | dirent = buf->previous; | 871 | dirent = buf->previous; |
868 | if (dirent) { | 872 | if (dirent) { |
869 | if (__put_user(offset, &dirent->d_off)) | 873 | if (__put_user(offset, &dirent->d_off)) |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 7a8db78a91d2..8e93341f3e82 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -1311,16 +1311,18 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
1311 | * Ensure that no racing symlink() will make detach_prep() fail while | 1311 | * Ensure that no racing symlink() will make detach_prep() fail while |
1312 | * the new link is temporarily attached | 1312 | * the new link is temporarily attached |
1313 | */ | 1313 | */ |
1314 | mutex_lock(&configfs_symlink_mutex); | ||
1315 | spin_lock(&configfs_dirent_lock); | ||
1316 | do { | 1314 | do { |
1317 | struct mutex *wait_mutex; | 1315 | struct mutex *wait_mutex; |
1318 | 1316 | ||
1317 | mutex_lock(&configfs_symlink_mutex); | ||
1318 | spin_lock(&configfs_dirent_lock); | ||
1319 | ret = configfs_detach_prep(dentry, &wait_mutex); | 1319 | ret = configfs_detach_prep(dentry, &wait_mutex); |
1320 | if (ret) { | 1320 | if (ret) |
1321 | configfs_detach_rollback(dentry); | 1321 | configfs_detach_rollback(dentry); |
1322 | spin_unlock(&configfs_dirent_lock); | 1322 | spin_unlock(&configfs_dirent_lock); |
1323 | mutex_unlock(&configfs_symlink_mutex); | 1323 | mutex_unlock(&configfs_symlink_mutex); |
1324 | |||
1325 | if (ret) { | ||
1324 | if (ret != -EAGAIN) { | 1326 | if (ret != -EAGAIN) { |
1325 | config_item_put(parent_item); | 1327 | config_item_put(parent_item); |
1326 | return ret; | 1328 | return ret; |
@@ -1329,13 +1331,8 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
1329 | /* Wait until the racing operation terminates */ | 1331 | /* Wait until the racing operation terminates */ |
1330 | mutex_lock(wait_mutex); | 1332 | mutex_lock(wait_mutex); |
1331 | mutex_unlock(wait_mutex); | 1333 | mutex_unlock(wait_mutex); |
1332 | |||
1333 | mutex_lock(&configfs_symlink_mutex); | ||
1334 | spin_lock(&configfs_dirent_lock); | ||
1335 | } | 1334 | } |
1336 | } while (ret == -EAGAIN); | 1335 | } while (ret == -EAGAIN); |
1337 | spin_unlock(&configfs_dirent_lock); | ||
1338 | mutex_unlock(&configfs_symlink_mutex); | ||
1339 | 1336 | ||
1340 | /* Get a working ref for the duration of this function */ | 1337 | /* Get a working ref for the duration of this function */ |
1341 | item = configfs_get_config_item(dentry); | 1338 | item = configfs_get_config_item(dentry); |
diff --git a/fs/dcache.c b/fs/dcache.c index 101663d15e9f..80e93956aced 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1236,7 +1236,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
1236 | * If no entry exists with the exact case name, allocate new dentry with | 1236 | * If no entry exists with the exact case name, allocate new dentry with |
1237 | * the exact case, and return the spliced entry. | 1237 | * the exact case, and return the spliced entry. |
1238 | */ | 1238 | */ |
1239 | struct dentry *d_add_ci(struct inode *inode, struct dentry *dentry, | 1239 | struct dentry *d_add_ci(struct dentry *dentry, struct inode *inode, |
1240 | struct qstr *name) | 1240 | struct qstr *name) |
1241 | { | 1241 | { |
1242 | int error; | 1242 | int error; |
diff --git a/fs/efs/namei.c b/fs/efs/namei.c index 3a404e7fad53..291abb11e20e 100644 --- a/fs/efs/namei.c +++ b/fs/efs/namei.c | |||
@@ -74,8 +74,7 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei | |||
74 | } | 74 | } |
75 | unlock_kernel(); | 75 | unlock_kernel(); |
76 | 76 | ||
77 | d_add(dentry, inode); | 77 | return d_splice_alias(inode, dentry); |
78 | return NULL; | ||
79 | } | 78 | } |
80 | 79 | ||
81 | static struct inode *efs_nfs_get_inode(struct super_block *sb, u64 ino, | 80 | static struct inode *efs_nfs_get_inode(struct super_block *sb, u64 ino, |
diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c index e1781c8b1650..9e8a95be7a1e 100644 --- a/fs/ntfs/namei.c +++ b/fs/ntfs/namei.c | |||
@@ -174,7 +174,6 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent, | |||
174 | // TODO: Consider moving this lot to a separate function! (AIA) | 174 | // TODO: Consider moving this lot to a separate function! (AIA) |
175 | handle_name: | 175 | handle_name: |
176 | { | 176 | { |
177 | struct dentry *real_dent, *new_dent; | ||
178 | MFT_RECORD *m; | 177 | MFT_RECORD *m; |
179 | ntfs_attr_search_ctx *ctx; | 178 | ntfs_attr_search_ctx *ctx; |
180 | ntfs_inode *ni = NTFS_I(dent_inode); | 179 | ntfs_inode *ni = NTFS_I(dent_inode); |
@@ -255,93 +254,9 @@ handle_name: | |||
255 | } | 254 | } |
256 | nls_name.hash = full_name_hash(nls_name.name, nls_name.len); | 255 | nls_name.hash = full_name_hash(nls_name.name, nls_name.len); |
257 | 256 | ||
258 | /* | 257 | dent = d_add_ci(dent, dent_inode, &nls_name); |
259 | * Note: No need for dent->d_lock lock as i_mutex is held on the | ||
260 | * parent inode. | ||
261 | */ | ||
262 | |||
263 | /* Does a dentry matching the nls_name exist already? */ | ||
264 | real_dent = d_lookup(dent->d_parent, &nls_name); | ||
265 | /* If not, create it now. */ | ||
266 | if (!real_dent) { | ||
267 | real_dent = d_alloc(dent->d_parent, &nls_name); | ||
268 | kfree(nls_name.name); | ||
269 | if (!real_dent) { | ||
270 | err = -ENOMEM; | ||
271 | goto err_out; | ||
272 | } | ||
273 | new_dent = d_splice_alias(dent_inode, real_dent); | ||
274 | if (new_dent) | ||
275 | dput(real_dent); | ||
276 | else | ||
277 | new_dent = real_dent; | ||
278 | ntfs_debug("Done. (Created new dentry.)"); | ||
279 | return new_dent; | ||
280 | } | ||
281 | kfree(nls_name.name); | 258 | kfree(nls_name.name); |
282 | /* Matching dentry exists, check if it is negative. */ | 259 | return dent; |
283 | if (real_dent->d_inode) { | ||
284 | if (unlikely(real_dent->d_inode != dent_inode)) { | ||
285 | /* This can happen because bad inodes are unhashed. */ | ||
286 | BUG_ON(!is_bad_inode(dent_inode)); | ||
287 | BUG_ON(!is_bad_inode(real_dent->d_inode)); | ||
288 | } | ||
289 | /* | ||
290 | * Already have the inode and the dentry attached, decrement | ||
291 | * the reference count to balance the ntfs_iget() we did | ||
292 | * earlier on. We found the dentry using d_lookup() so it | ||
293 | * cannot be disconnected and thus we do not need to worry | ||
294 | * about any NFS/disconnectedness issues here. | ||
295 | */ | ||
296 | iput(dent_inode); | ||
297 | ntfs_debug("Done. (Already had inode and dentry.)"); | ||
298 | return real_dent; | ||
299 | } | ||
300 | /* | ||
301 | * Negative dentry: instantiate it unless the inode is a directory and | ||
302 | * has a 'disconnected' dentry (i.e. IS_ROOT and DCACHE_DISCONNECTED), | ||
303 | * in which case d_move() that in place of the found dentry. | ||
304 | */ | ||
305 | if (!S_ISDIR(dent_inode->i_mode)) { | ||
306 | /* Not a directory; everything is easy. */ | ||
307 | d_instantiate(real_dent, dent_inode); | ||
308 | ntfs_debug("Done. (Already had negative file dentry.)"); | ||
309 | return real_dent; | ||
310 | } | ||
311 | spin_lock(&dcache_lock); | ||
312 | if (list_empty(&dent_inode->i_dentry)) { | ||
313 | /* | ||
314 | * Directory without a 'disconnected' dentry; we need to do | ||
315 | * d_instantiate() by hand because it takes dcache_lock which | ||
316 | * we already hold. | ||
317 | */ | ||
318 | list_add(&real_dent->d_alias, &dent_inode->i_dentry); | ||
319 | real_dent->d_inode = dent_inode; | ||
320 | spin_unlock(&dcache_lock); | ||
321 | security_d_instantiate(real_dent, dent_inode); | ||
322 | ntfs_debug("Done. (Already had negative directory dentry.)"); | ||
323 | return real_dent; | ||
324 | } | ||
325 | /* | ||
326 | * Directory with a 'disconnected' dentry; get a reference to the | ||
327 | * 'disconnected' dentry. | ||
328 | */ | ||
329 | new_dent = list_entry(dent_inode->i_dentry.next, struct dentry, | ||
330 | d_alias); | ||
331 | dget_locked(new_dent); | ||
332 | spin_unlock(&dcache_lock); | ||
333 | /* Do security vodoo. */ | ||
334 | security_d_instantiate(real_dent, dent_inode); | ||
335 | /* Move new_dent in place of real_dent. */ | ||
336 | d_move(new_dent, real_dent); | ||
337 | /* Balance the ntfs_iget() we did above. */ | ||
338 | iput(dent_inode); | ||
339 | /* Throw away real_dent. */ | ||
340 | dput(real_dent); | ||
341 | /* Use new_dent as the actual dentry. */ | ||
342 | ntfs_debug("Done. (Already had negative, disconnected directory " | ||
343 | "dentry.)"); | ||
344 | return new_dent; | ||
345 | 260 | ||
346 | eio_err_out: | 261 | eio_err_out: |
347 | ntfs_error(vol->sb, "Illegal file name attribute. Run chkdsk."); | 262 | ntfs_error(vol->sb, "Illegal file name attribute. Run chkdsk."); |
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index d8bfa0eb41b2..52276c02f710 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c | |||
@@ -138,20 +138,20 @@ static int nst_seq_show(struct seq_file *seq, void *v) | |||
138 | " message id: %d\n" | 138 | " message id: %d\n" |
139 | " message type: %u\n" | 139 | " message type: %u\n" |
140 | " message key: 0x%08x\n" | 140 | " message key: 0x%08x\n" |
141 | " sock acquiry: %lu.%lu\n" | 141 | " sock acquiry: %lu.%ld\n" |
142 | " send start: %lu.%lu\n" | 142 | " send start: %lu.%ld\n" |
143 | " wait start: %lu.%lu\n", | 143 | " wait start: %lu.%ld\n", |
144 | nst, (unsigned long)nst->st_task->pid, | 144 | nst, (unsigned long)nst->st_task->pid, |
145 | (unsigned long)nst->st_task->tgid, | 145 | (unsigned long)nst->st_task->tgid, |
146 | nst->st_task->comm, nst->st_node, | 146 | nst->st_task->comm, nst->st_node, |
147 | nst->st_sc, nst->st_id, nst->st_msg_type, | 147 | nst->st_sc, nst->st_id, nst->st_msg_type, |
148 | nst->st_msg_key, | 148 | nst->st_msg_key, |
149 | nst->st_sock_time.tv_sec, | 149 | nst->st_sock_time.tv_sec, |
150 | (unsigned long)nst->st_sock_time.tv_usec, | 150 | (long)nst->st_sock_time.tv_usec, |
151 | nst->st_send_time.tv_sec, | 151 | nst->st_send_time.tv_sec, |
152 | (unsigned long)nst->st_send_time.tv_usec, | 152 | (long)nst->st_send_time.tv_usec, |
153 | nst->st_status_time.tv_sec, | 153 | nst->st_status_time.tv_sec, |
154 | nst->st_status_time.tv_usec); | 154 | (long)nst->st_status_time.tv_usec); |
155 | } | 155 | } |
156 | 156 | ||
157 | spin_unlock(&o2net_debug_lock); | 157 | spin_unlock(&o2net_debug_lock); |
@@ -276,7 +276,7 @@ static void *sc_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
276 | return sc; /* unused, just needs to be null when done */ | 276 | return sc; /* unused, just needs to be null when done */ |
277 | } | 277 | } |
278 | 278 | ||
279 | #define TV_SEC_USEC(TV) TV.tv_sec, (unsigned long)TV.tv_usec | 279 | #define TV_SEC_USEC(TV) TV.tv_sec, (long)TV.tv_usec |
280 | 280 | ||
281 | static int sc_seq_show(struct seq_file *seq, void *v) | 281 | static int sc_seq_show(struct seq_file *seq, void *v) |
282 | { | 282 | { |
@@ -309,12 +309,12 @@ static int sc_seq_show(struct seq_file *seq, void *v) | |||
309 | " remote node: %s\n" | 309 | " remote node: %s\n" |
310 | " page off: %zu\n" | 310 | " page off: %zu\n" |
311 | " handshake ok: %u\n" | 311 | " handshake ok: %u\n" |
312 | " timer: %lu.%lu\n" | 312 | " timer: %lu.%ld\n" |
313 | " data ready: %lu.%lu\n" | 313 | " data ready: %lu.%ld\n" |
314 | " advance start: %lu.%lu\n" | 314 | " advance start: %lu.%ld\n" |
315 | " advance stop: %lu.%lu\n" | 315 | " advance stop: %lu.%ld\n" |
316 | " func start: %lu.%lu\n" | 316 | " func start: %lu.%ld\n" |
317 | " func stop: %lu.%lu\n" | 317 | " func stop: %lu.%ld\n" |
318 | " func key: %u\n" | 318 | " func key: %u\n" |
319 | " func type: %u\n", | 319 | " func type: %u\n", |
320 | sc, | 320 | sc, |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index a27d61581bd6..2bcf706d9dd3 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -143,8 +143,8 @@ static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); | |||
143 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); | 143 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); |
144 | 144 | ||
145 | #ifdef CONFIG_DEBUG_FS | 145 | #ifdef CONFIG_DEBUG_FS |
146 | void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | 146 | static void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, |
147 | u32 msgkey, struct task_struct *task, u8 node) | 147 | u32 msgkey, struct task_struct *task, u8 node) |
148 | { | 148 | { |
149 | INIT_LIST_HEAD(&nst->st_net_debug_item); | 149 | INIT_LIST_HEAD(&nst->st_net_debug_item); |
150 | nst->st_task = task; | 150 | nst->st_task = task; |
@@ -153,31 +153,61 @@ void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | |||
153 | nst->st_node = node; | 153 | nst->st_node = node; |
154 | } | 154 | } |
155 | 155 | ||
156 | void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) | 156 | static void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) |
157 | { | 157 | { |
158 | do_gettimeofday(&nst->st_sock_time); | 158 | do_gettimeofday(&nst->st_sock_time); |
159 | } | 159 | } |
160 | 160 | ||
161 | void o2net_set_nst_send_time(struct o2net_send_tracking *nst) | 161 | static void o2net_set_nst_send_time(struct o2net_send_tracking *nst) |
162 | { | 162 | { |
163 | do_gettimeofday(&nst->st_send_time); | 163 | do_gettimeofday(&nst->st_send_time); |
164 | } | 164 | } |
165 | 165 | ||
166 | void o2net_set_nst_status_time(struct o2net_send_tracking *nst) | 166 | static void o2net_set_nst_status_time(struct o2net_send_tracking *nst) |
167 | { | 167 | { |
168 | do_gettimeofday(&nst->st_status_time); | 168 | do_gettimeofday(&nst->st_status_time); |
169 | } | 169 | } |
170 | 170 | ||
171 | void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | 171 | static void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, |
172 | struct o2net_sock_container *sc) | 172 | struct o2net_sock_container *sc) |
173 | { | 173 | { |
174 | nst->st_sc = sc; | 174 | nst->st_sc = sc; |
175 | } | 175 | } |
176 | 176 | ||
177 | void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id) | 177 | static void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id) |
178 | { | 178 | { |
179 | nst->st_id = msg_id; | 179 | nst->st_id = msg_id; |
180 | } | 180 | } |
181 | |||
182 | #else /* CONFIG_DEBUG_FS */ | ||
183 | |||
184 | static inline void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
185 | u32 msgkey, struct task_struct *task, u8 node) | ||
186 | { | ||
187 | } | ||
188 | |||
189 | static inline void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) | ||
190 | { | ||
191 | } | ||
192 | |||
193 | static inline void o2net_set_nst_send_time(struct o2net_send_tracking *nst) | ||
194 | { | ||
195 | } | ||
196 | |||
197 | static inline void o2net_set_nst_status_time(struct o2net_send_tracking *nst) | ||
198 | { | ||
199 | } | ||
200 | |||
201 | static inline void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | ||
202 | struct o2net_sock_container *sc) | ||
203 | { | ||
204 | } | ||
205 | |||
206 | static inline void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, | ||
207 | u32 msg_id) | ||
208 | { | ||
209 | } | ||
210 | |||
181 | #endif /* CONFIG_DEBUG_FS */ | 211 | #endif /* CONFIG_DEBUG_FS */ |
182 | 212 | ||
183 | static inline int o2net_reconnect_delay(void) | 213 | static inline int o2net_reconnect_delay(void) |
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index 18307ff81b77..8d58cfe410b1 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h | |||
@@ -224,42 +224,10 @@ struct o2net_send_tracking { | |||
224 | struct timeval st_send_time; | 224 | struct timeval st_send_time; |
225 | struct timeval st_status_time; | 225 | struct timeval st_status_time; |
226 | }; | 226 | }; |
227 | |||
228 | void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
229 | u32 msgkey, struct task_struct *task, u8 node); | ||
230 | void o2net_set_nst_sock_time(struct o2net_send_tracking *nst); | ||
231 | void o2net_set_nst_send_time(struct o2net_send_tracking *nst); | ||
232 | void o2net_set_nst_status_time(struct o2net_send_tracking *nst); | ||
233 | void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | ||
234 | struct o2net_sock_container *sc); | ||
235 | void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id); | ||
236 | |||
237 | #else | 227 | #else |
238 | struct o2net_send_tracking { | 228 | struct o2net_send_tracking { |
239 | u32 dummy; | 229 | u32 dummy; |
240 | }; | 230 | }; |
241 | |||
242 | static inline void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
243 | u32 msgkey, struct task_struct *task, u8 node) | ||
244 | { | ||
245 | } | ||
246 | static inline void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) | ||
247 | { | ||
248 | } | ||
249 | static inline void o2net_set_nst_send_time(struct o2net_send_tracking *nst) | ||
250 | { | ||
251 | } | ||
252 | static inline void o2net_set_nst_status_time(struct o2net_send_tracking *nst) | ||
253 | { | ||
254 | } | ||
255 | static inline void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | ||
256 | struct o2net_sock_container *sc) | ||
257 | { | ||
258 | } | ||
259 | static inline void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, | ||
260 | u32 msg_id) | ||
261 | { | ||
262 | } | ||
263 | #endif /* CONFIG_DEBUG_FS */ | 231 | #endif /* CONFIG_DEBUG_FS */ |
264 | 232 | ||
265 | #endif /* O2CLUSTER_TCP_INTERNAL_H */ | 233 | #endif /* O2CLUSTER_TCP_INTERNAL_H */ |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 8a1875848080..9cce563fd627 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -1300,7 +1300,6 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
1300 | di->i_size = cpu_to_le64(sb->s_blocksize); | 1300 | di->i_size = cpu_to_le64(sb->s_blocksize); |
1301 | di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); | 1301 | di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); |
1302 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); | 1302 | di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); |
1303 | dir->i_blocks = ocfs2_inode_sector_count(dir); | ||
1304 | 1303 | ||
1305 | /* | 1304 | /* |
1306 | * This should never fail as our extent list is empty and all | 1305 | * This should never fail as our extent list is empty and all |
@@ -1310,9 +1309,15 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
1310 | NULL); | 1309 | NULL); |
1311 | if (ret) { | 1310 | if (ret) { |
1312 | mlog_errno(ret); | 1311 | mlog_errno(ret); |
1313 | goto out; | 1312 | goto out_commit; |
1314 | } | 1313 | } |
1315 | 1314 | ||
1315 | /* | ||
1316 | * Set i_blocks after the extent insert for the most up to | ||
1317 | * date ip_clusters value. | ||
1318 | */ | ||
1319 | dir->i_blocks = ocfs2_inode_sector_count(dir); | ||
1320 | |||
1316 | ret = ocfs2_journal_dirty(handle, di_bh); | 1321 | ret = ocfs2_journal_dirty(handle, di_bh); |
1317 | if (ret) { | 1322 | if (ret) { |
1318 | mlog_errno(ret); | 1323 | mlog_errno(ret); |
@@ -1336,7 +1341,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
1336 | len, 0, NULL); | 1341 | len, 0, NULL); |
1337 | if (ret) { | 1342 | if (ret) { |
1338 | mlog_errno(ret); | 1343 | mlog_errno(ret); |
1339 | goto out; | 1344 | goto out_commit; |
1340 | } | 1345 | } |
1341 | } | 1346 | } |
1342 | 1347 | ||
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 7a37240f7a31..c47bc2a809c2 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -1418,13 +1418,13 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb) | |||
1418 | { | 1418 | { |
1419 | unsigned int node_num; | 1419 | unsigned int node_num; |
1420 | int status, i; | 1420 | int status, i; |
1421 | u32 gen; | ||
1421 | struct buffer_head *bh = NULL; | 1422 | struct buffer_head *bh = NULL; |
1422 | struct ocfs2_dinode *di; | 1423 | struct ocfs2_dinode *di; |
1423 | 1424 | ||
1424 | /* This is called with the super block cluster lock, so we | 1425 | /* This is called with the super block cluster lock, so we |
1425 | * know that the slot map can't change underneath us. */ | 1426 | * know that the slot map can't change underneath us. */ |
1426 | 1427 | ||
1427 | spin_lock(&osb->osb_lock); | ||
1428 | for (i = 0; i < osb->max_slots; i++) { | 1428 | for (i = 0; i < osb->max_slots; i++) { |
1429 | /* Read journal inode to get the recovery generation */ | 1429 | /* Read journal inode to get the recovery generation */ |
1430 | status = ocfs2_read_journal_inode(osb, i, &bh, NULL); | 1430 | status = ocfs2_read_journal_inode(osb, i, &bh, NULL); |
@@ -1433,23 +1433,31 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb) | |||
1433 | goto bail; | 1433 | goto bail; |
1434 | } | 1434 | } |
1435 | di = (struct ocfs2_dinode *)bh->b_data; | 1435 | di = (struct ocfs2_dinode *)bh->b_data; |
1436 | osb->slot_recovery_generations[i] = | 1436 | gen = ocfs2_get_recovery_generation(di); |
1437 | ocfs2_get_recovery_generation(di); | ||
1438 | brelse(bh); | 1437 | brelse(bh); |
1439 | bh = NULL; | 1438 | bh = NULL; |
1440 | 1439 | ||
1440 | spin_lock(&osb->osb_lock); | ||
1441 | osb->slot_recovery_generations[i] = gen; | ||
1442 | |||
1441 | mlog(0, "Slot %u recovery generation is %u\n", i, | 1443 | mlog(0, "Slot %u recovery generation is %u\n", i, |
1442 | osb->slot_recovery_generations[i]); | 1444 | osb->slot_recovery_generations[i]); |
1443 | 1445 | ||
1444 | if (i == osb->slot_num) | 1446 | if (i == osb->slot_num) { |
1447 | spin_unlock(&osb->osb_lock); | ||
1445 | continue; | 1448 | continue; |
1449 | } | ||
1446 | 1450 | ||
1447 | status = ocfs2_slot_to_node_num_locked(osb, i, &node_num); | 1451 | status = ocfs2_slot_to_node_num_locked(osb, i, &node_num); |
1448 | if (status == -ENOENT) | 1452 | if (status == -ENOENT) { |
1453 | spin_unlock(&osb->osb_lock); | ||
1449 | continue; | 1454 | continue; |
1455 | } | ||
1450 | 1456 | ||
1451 | if (__ocfs2_recovery_map_test(osb, node_num)) | 1457 | if (__ocfs2_recovery_map_test(osb, node_num)) { |
1458 | spin_unlock(&osb->osb_lock); | ||
1452 | continue; | 1459 | continue; |
1460 | } | ||
1453 | spin_unlock(&osb->osb_lock); | 1461 | spin_unlock(&osb->osb_lock); |
1454 | 1462 | ||
1455 | /* Ok, we have a slot occupied by another node which | 1463 | /* Ok, we have a slot occupied by another node which |
@@ -1465,10 +1473,7 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb) | |||
1465 | mlog_errno(status); | 1473 | mlog_errno(status); |
1466 | goto bail; | 1474 | goto bail; |
1467 | } | 1475 | } |
1468 | |||
1469 | spin_lock(&osb->osb_lock); | ||
1470 | } | 1476 | } |
1471 | spin_unlock(&osb->osb_lock); | ||
1472 | 1477 | ||
1473 | status = 0; | 1478 | status = 0; |
1474 | bail: | 1479 | bail: |
diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index 10e149ae5e3a..07f348b8d721 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c | |||
@@ -97,13 +97,14 @@ static int ocfs2_stack_driver_request(const char *stack_name, | |||
97 | goto out; | 97 | goto out; |
98 | } | 98 | } |
99 | 99 | ||
100 | /* Ok, the stack is pinned */ | ||
101 | p->sp_count++; | ||
102 | active_stack = p; | 100 | active_stack = p; |
103 | |||
104 | rc = 0; | 101 | rc = 0; |
105 | 102 | ||
106 | out: | 103 | out: |
104 | /* If we found it, pin it */ | ||
105 | if (!rc) | ||
106 | active_stack->sp_count++; | ||
107 | |||
107 | spin_unlock(&ocfs2_stack_lock); | 108 | spin_unlock(&ocfs2_stack_lock); |
108 | return rc; | 109 | return rc; |
109 | } | 110 | } |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 4fb81e9c94e3..bca0f81eb687 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -330,6 +330,7 @@ retry: | |||
330 | spin_lock(&proc_inum_lock); | 330 | spin_lock(&proc_inum_lock); |
331 | ida_remove(&proc_inum_ida, i); | 331 | ida_remove(&proc_inum_ida, i); |
332 | spin_unlock(&proc_inum_lock); | 332 | spin_unlock(&proc_inum_lock); |
333 | return 0; | ||
333 | } | 334 | } |
334 | return PROC_DYNAMIC_FIRST + i; | 335 | return PROC_DYNAMIC_FIRST + i; |
335 | } | 336 | } |
diff --git a/fs/readdir.c b/fs/readdir.c index 4e026e5407fb..93a7559bbfd8 100644 --- a/fs/readdir.c +++ b/fs/readdir.c | |||
@@ -80,8 +80,10 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset | |||
80 | if (buf->result) | 80 | if (buf->result) |
81 | return -EINVAL; | 81 | return -EINVAL; |
82 | d_ino = ino; | 82 | d_ino = ino; |
83 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | 83 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { |
84 | buf->result = -EOVERFLOW; | ||
84 | return -EOVERFLOW; | 85 | return -EOVERFLOW; |
86 | } | ||
85 | buf->result++; | 87 | buf->result++; |
86 | dirent = buf->dirent; | 88 | dirent = buf->dirent; |
87 | if (!access_ok(VERIFY_WRITE, dirent, | 89 | if (!access_ok(VERIFY_WRITE, dirent, |
@@ -155,8 +157,10 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset, | |||
155 | if (reclen > buf->count) | 157 | if (reclen > buf->count) |
156 | return -EINVAL; | 158 | return -EINVAL; |
157 | d_ino = ino; | 159 | d_ino = ino; |
158 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | 160 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) { |
161 | buf->error = -EOVERFLOW; | ||
159 | return -EOVERFLOW; | 162 | return -EOVERFLOW; |
163 | } | ||
160 | dirent = buf->previous; | 164 | dirent = buf->previous; |
161 | if (dirent) { | 165 | if (dirent) { |
162 | if (__put_user(offset, &dirent->d_off)) | 166 | if (__put_user(offset, &dirent->d_off)) |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 5d54205e486b..bd20f7f5a933 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -108,9 +108,9 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
108 | goto Done; | 108 | goto Done; |
109 | } | 109 | } |
110 | /* we need at least one record in buffer */ | 110 | /* we need at least one record in buffer */ |
111 | pos = m->index; | ||
112 | p = m->op->start(m, &pos); | ||
111 | while (1) { | 113 | while (1) { |
112 | pos = m->index; | ||
113 | p = m->op->start(m, &pos); | ||
114 | err = PTR_ERR(p); | 114 | err = PTR_ERR(p); |
115 | if (!p || IS_ERR(p)) | 115 | if (!p || IS_ERR(p)) |
116 | break; | 116 | break; |
@@ -119,6 +119,11 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
119 | break; | 119 | break; |
120 | if (unlikely(err)) | 120 | if (unlikely(err)) |
121 | m->count = 0; | 121 | m->count = 0; |
122 | if (unlikely(!m->count)) { | ||
123 | p = m->op->next(m, p, &pos); | ||
124 | m->index = pos; | ||
125 | continue; | ||
126 | } | ||
122 | if (m->count < m->size) | 127 | if (m->count < m->size) |
123 | goto Fill; | 128 | goto Fill; |
124 | m->op->stop(m, p); | 129 | m->op->stop(m, p); |
@@ -128,6 +133,8 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) | |||
128 | goto Enomem; | 133 | goto Enomem; |
129 | m->count = 0; | 134 | m->count = 0; |
130 | m->version = 0; | 135 | m->version = 0; |
136 | pos = m->index; | ||
137 | p = m->op->start(m, &pos); | ||
131 | } | 138 | } |
132 | m->op->stop(m, p); | 139 | m->op->stop(m, p); |
133 | m->count = 0; | 140 | m->count = 0; |
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 5f60363b9343..5311c1acdd40 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -475,6 +475,7 @@ const struct file_operations xfs_invis_file_operations = { | |||
475 | const struct file_operations xfs_dir_file_operations = { | 475 | const struct file_operations xfs_dir_file_operations = { |
476 | .read = generic_read_dir, | 476 | .read = generic_read_dir, |
477 | .readdir = xfs_file_readdir, | 477 | .readdir = xfs_file_readdir, |
478 | .llseek = generic_file_llseek, | ||
478 | .unlocked_ioctl = xfs_file_ioctl, | 479 | .unlocked_ioctl = xfs_file_ioctl, |
479 | #ifdef CONFIG_COMPAT | 480 | #ifdef CONFIG_COMPAT |
480 | .compat_ioctl = xfs_file_compat_ioctl, | 481 | .compat_ioctl = xfs_file_compat_ioctl, |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 91bcd979242c..095d271f3434 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -355,7 +355,7 @@ xfs_vn_ci_lookup( | |||
355 | /* else case-insensitive match... */ | 355 | /* else case-insensitive match... */ |
356 | dname.name = ci_name.name; | 356 | dname.name = ci_name.name; |
357 | dname.len = ci_name.len; | 357 | dname.len = ci_name.len; |
358 | dentry = d_add_ci(VFS_I(ip), dentry, &dname); | 358 | dentry = d_add_ci(dentry, VFS_I(ip), &dname); |
359 | kmem_free(ci_name.name); | 359 | kmem_free(ci_name.name); |
360 | return dentry; | 360 | return dentry; |
361 | } | 361 | } |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e61f22be4d0e..44710d7e7bff 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -280,6 +280,15 @@ struct blk_queue_tag { | |||
280 | atomic_t refcnt; /* map can be shared */ | 280 | atomic_t refcnt; /* map can be shared */ |
281 | }; | 281 | }; |
282 | 282 | ||
283 | #define BLK_SCSI_MAX_CMDS (256) | ||
284 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | ||
285 | |||
286 | struct blk_cmd_filter { | ||
287 | unsigned long read_ok[BLK_SCSI_CMD_PER_LONG]; | ||
288 | unsigned long write_ok[BLK_SCSI_CMD_PER_LONG]; | ||
289 | struct kobject kobj; | ||
290 | }; | ||
291 | |||
283 | struct request_queue | 292 | struct request_queue |
284 | { | 293 | { |
285 | /* | 294 | /* |
@@ -398,6 +407,7 @@ struct request_queue | |||
398 | #if defined(CONFIG_BLK_DEV_BSG) | 407 | #if defined(CONFIG_BLK_DEV_BSG) |
399 | struct bsg_class_device bsg_dev; | 408 | struct bsg_class_device bsg_dev; |
400 | #endif | 409 | #endif |
410 | struct blk_cmd_filter cmd_filter; | ||
401 | }; | 411 | }; |
402 | 412 | ||
403 | #define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ | 413 | #define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ |
@@ -807,8 +817,6 @@ extern void blk_put_queue(struct request_queue *); | |||
807 | /* | 817 | /* |
808 | * tag stuff | 818 | * tag stuff |
809 | */ | 819 | */ |
810 | #define blk_queue_tag_depth(q) ((q)->queue_tags->busy) | ||
811 | #define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth) | ||
812 | #define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) | 820 | #define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) |
813 | extern int blk_queue_start_tag(struct request_queue *, struct request *); | 821 | extern int blk_queue_start_tag(struct request_queue *, struct request *); |
814 | extern struct request *blk_queue_find_tag(struct request_queue *, int); | 822 | extern struct request *blk_queue_find_tag(struct request_queue *, int); |
@@ -833,11 +841,11 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *); | |||
833 | /* | 841 | /* |
834 | * command filter functions | 842 | * command filter functions |
835 | */ | 843 | */ |
836 | extern int blk_verify_command(struct file *file, unsigned char *cmd); | 844 | extern int blk_verify_command(struct blk_cmd_filter *filter, |
837 | extern int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter, | 845 | unsigned char *cmd, int has_write_perm); |
838 | unsigned char *cmd, mode_t *f_mode); | ||
839 | extern int blk_register_filter(struct gendisk *disk); | 846 | extern int blk_register_filter(struct gendisk *disk); |
840 | extern void blk_unregister_filter(struct gendisk *disk); | 847 | extern void blk_unregister_filter(struct gendisk *disk); |
848 | extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); | ||
841 | 849 | ||
842 | #define MAX_PHYS_SEGMENTS 128 | 850 | #define MAX_PHYS_SEGMENTS 128 |
843 | #define MAX_HW_SEGMENTS 128 | 851 | #define MAX_HW_SEGMENTS 128 |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 07aa198f19ed..efba1de629ac 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -230,7 +230,7 @@ extern void d_delete(struct dentry *); | |||
230 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); | 230 | extern struct dentry * d_alloc(struct dentry *, const struct qstr *); |
231 | extern struct dentry * d_alloc_anon(struct inode *); | 231 | extern struct dentry * d_alloc_anon(struct inode *); |
232 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); | 232 | extern struct dentry * d_splice_alias(struct inode *, struct dentry *); |
233 | extern struct dentry * d_add_ci(struct inode *, struct dentry *, struct qstr *); | 233 | extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); |
234 | extern void shrink_dcache_sb(struct super_block *); | 234 | extern void shrink_dcache_sb(struct super_block *); |
235 | extern void shrink_dcache_parent(struct dentry *); | 235 | extern void shrink_dcache_parent(struct dentry *); |
236 | extern void shrink_dcache_for_umount(struct super_block *); | 236 | extern void shrink_dcache_for_umount(struct super_block *); |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 118216f1bd3c..be4f5e5bfe06 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -110,15 +110,6 @@ struct hd_struct { | |||
110 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 110 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
111 | #define GENHD_FL_FAIL 64 | 111 | #define GENHD_FL_FAIL 64 |
112 | 112 | ||
113 | #define BLK_SCSI_MAX_CMDS (256) | ||
114 | #define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) | ||
115 | |||
116 | struct blk_scsi_cmd_filter { | ||
117 | unsigned long read_ok[BLK_SCSI_CMD_PER_LONG]; | ||
118 | unsigned long write_ok[BLK_SCSI_CMD_PER_LONG]; | ||
119 | struct kobject kobj; | ||
120 | }; | ||
121 | |||
122 | struct gendisk { | 113 | struct gendisk { |
123 | int major; /* major number of driver */ | 114 | int major; /* major number of driver */ |
124 | int first_minor; | 115 | int first_minor; |
@@ -128,7 +119,6 @@ struct gendisk { | |||
128 | struct hd_struct **part; /* [indexed by minor] */ | 119 | struct hd_struct **part; /* [indexed by minor] */ |
129 | struct block_device_operations *fops; | 120 | struct block_device_operations *fops; |
130 | struct request_queue *queue; | 121 | struct request_queue *queue; |
131 | struct blk_scsi_cmd_filter cmd_filter; | ||
132 | void *private_data; | 122 | void *private_data; |
133 | sector_t capacity; | 123 | sector_t capacity; |
134 | 124 | ||
diff --git a/kernel/power/main.c b/kernel/power/main.c index 0b7476f5d2a6..540b16b68565 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/freezer.h> | 21 | #include <linux/freezer.h> |
22 | #include <linux/vmstat.h> | 22 | #include <linux/vmstat.h> |
23 | #include <linux/syscalls.h> | 23 | #include <linux/syscalls.h> |
24 | #include <linux/ftrace.h> | ||
24 | 25 | ||
25 | #include "power.h" | 26 | #include "power.h" |
26 | 27 | ||
@@ -310,7 +311,7 @@ static int suspend_enter(suspend_state_t state) | |||
310 | */ | 311 | */ |
311 | int suspend_devices_and_enter(suspend_state_t state) | 312 | int suspend_devices_and_enter(suspend_state_t state) |
312 | { | 313 | { |
313 | int error; | 314 | int error, ftrace_save; |
314 | 315 | ||
315 | if (!suspend_ops) | 316 | if (!suspend_ops) |
316 | return -ENOSYS; | 317 | return -ENOSYS; |
@@ -321,6 +322,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
321 | goto Close; | 322 | goto Close; |
322 | } | 323 | } |
323 | suspend_console(); | 324 | suspend_console(); |
325 | ftrace_save = __ftrace_enabled_save(); | ||
324 | suspend_test_start(); | 326 | suspend_test_start(); |
325 | error = device_suspend(PMSG_SUSPEND); | 327 | error = device_suspend(PMSG_SUSPEND); |
326 | if (error) { | 328 | if (error) { |
@@ -352,6 +354,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
352 | suspend_test_start(); | 354 | suspend_test_start(); |
353 | device_resume(PMSG_RESUME); | 355 | device_resume(PMSG_RESUME); |
354 | suspend_test_finish("resume devices"); | 356 | suspend_test_finish("resume devices"); |
357 | __ftrace_enabled_restore(ftrace_save); | ||
355 | resume_console(); | 358 | resume_console(); |
356 | Close: | 359 | Close: |
357 | if (suspend_ops->end) | 360 | if (suspend_ops->end) |
@@ -2312,7 +2312,7 @@ static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, | |||
2312 | 2312 | ||
2313 | s->refcount = 1; | 2313 | s->refcount = 1; |
2314 | #ifdef CONFIG_NUMA | 2314 | #ifdef CONFIG_NUMA |
2315 | s->remote_node_defrag_ratio = 100; | 2315 | s->remote_node_defrag_ratio = 1000; |
2316 | #endif | 2316 | #endif |
2317 | if (!init_kmem_cache_nodes(s, gfpflags & ~SLUB_DMA)) | 2317 | if (!init_kmem_cache_nodes(s, gfpflags & ~SLUB_DMA)) |
2318 | goto error; | 2318 | goto error; |
@@ -4058,7 +4058,7 @@ static ssize_t remote_node_defrag_ratio_store(struct kmem_cache *s, | |||
4058 | if (err) | 4058 | if (err) |
4059 | return err; | 4059 | return err; |
4060 | 4060 | ||
4061 | if (ratio < 100) | 4061 | if (ratio <= 100) |
4062 | s->remote_node_defrag_ratio = ratio * 10; | 4062 | s->remote_node_defrag_ratio = ratio * 10; |
4063 | 4063 | ||
4064 | return length; | 4064 | return length; |