From 3eb27988cbf9a04296fab268ca9de25619c9f340 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 27 Jun 2004 19:06:26 -0700 Subject: ppc64: fix silly typo ("1" vs "i"). --- arch/ppc64/kernel/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ppc64/kernel/irq.c b/arch/ppc64/kernel/irq.c index 27e11b3dfd02..97be40525c47 100644 --- a/arch/ppc64/kernel/irq.c +++ b/arch/ppc64/kernel/irq.c @@ -807,7 +807,7 @@ static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffe { unsigned i; for (i=0; i Date: Sun, 27 Jun 2004 23:10:38 -0700 Subject: [AIO]: kiocb->private is too large for kiocb's on-stack. sizeof(struct kiocb) is dangerously large for a structure commonly allocated on-stack. This patch converts the 24*sizeof(long) field, ->private, to a void pointer for use by file_operations entrypoints. A ->dtor() method is added to the kiocb in order to support the release of dynamically allocated structures referred to by ->private. The sole in-tree users of ->private are async network read/write, which are not, in fact, async, and so need not handle preallocated ->private as they would need to if ->ki_retry were ever used. The sole truly async operations are direct IO pread()/pwrite() which do not now use ->ki_retry(). All they would need to do in that case is to check for ->private already being allocated for async kiocbs. This rips 88B off the stack on 32-bit in the common case. Signed-off-by: William Lee Irwin III Signed-off-by: David S. Miller --- fs/aio.c | 6 ++++++ include/linux/aio.h | 7 +++---- include/net/sock.h | 4 ++-- net/socket.c | 33 +++++++++++++++++++++++++++++++-- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 6788528f203f..6b109f029250 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -396,6 +396,8 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx) req->ki_cancel = NULL; req->ki_retry = NULL; req->ki_obj.user = NULL; + req->ki_dtor = NULL; + req->private = NULL; /* Check if the completion queue has enough free space to * accept an event from this io. @@ -436,9 +438,13 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx) static inline void really_put_req(struct kioctx *ctx, struct kiocb *req) { + if (req->ki_dtor) + req->ki_dtor(req); req->ki_ctx = NULL; req->ki_filp = NULL; req->ki_obj.user = NULL; + req->ki_dtor = NULL; + req->private = NULL; kmem_cache_free(kiocb_cachep, req); ctx->reqs_active--; diff --git a/include/linux/aio.h b/include/linux/aio.h index 93fe78800740..461a3b0736e0 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h @@ -23,8 +23,6 @@ struct kioctx; #define KIOCB_SYNC_KEY (~0U) -#define KIOCB_PRIVATE_SIZE (24 * sizeof(long)) - /* ki_flags bits */ #define KIF_LOCKED 0 #define KIF_KICKED 1 @@ -55,6 +53,7 @@ struct kiocb { struct kioctx *ki_ctx; /* may be NULL for sync ops */ int (*ki_cancel)(struct kiocb *, struct io_event *); long (*ki_retry)(struct kiocb *); + void (*ki_dtor)(struct kiocb *); struct list_head ki_list; /* the aio core uses this * for cancellation */ @@ -65,8 +64,7 @@ struct kiocb { } ki_obj; __u64 ki_user_data; /* user's data for completion */ loff_t ki_pos; - - char private[KIOCB_PRIVATE_SIZE]; + void *private; }; #define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY) @@ -79,6 +77,7 @@ struct kiocb { (x)->ki_filp = (filp); \ (x)->ki_ctx = &tsk->active_mm->default_kioctx; \ (x)->ki_cancel = NULL; \ + (x)->ki_dtor = NULL; \ (x)->ki_obj.tsk = tsk; \ } while (0) diff --git a/include/net/sock.h b/include/net/sock.h index c3277f3ecb20..4dcba49115ba 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -617,17 +617,17 @@ struct sock_iocb { struct scm_cookie *scm; struct msghdr *msg, async_msg; struct iovec async_iov; + struct kiocb *kiocb; }; static inline struct sock_iocb *kiocb_to_siocb(struct kiocb *iocb) { - BUG_ON(sizeof(struct sock_iocb) > KIOCB_PRIVATE_SIZE); return (struct sock_iocb *)iocb->private; } static inline struct kiocb *siocb_to_kiocb(struct sock_iocb *si) { - return container_of((void *)si, struct kiocb, private); + return si->kiocb; } struct socket_alloc { diff --git a/net/socket.c b/net/socket.c index 1aa2ce2a3139..d9e336637739 100644 --- a/net/socket.c +++ b/net/socket.c @@ -548,9 +548,11 @@ static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) { struct kiocb iocb; + struct sock_iocb siocb; int ret; init_sync_kiocb(&iocb, NULL); + iocb.private = &siocb; ret = __sock_sendmsg(&iocb, sock, msg, size); if (-EIOCBQUEUED == ret) ret = wait_on_sync_kiocb(&iocb); @@ -581,15 +583,22 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct kiocb iocb; + struct sock_iocb siocb; int ret; init_sync_kiocb(&iocb, NULL); + iocb.private = &siocb; ret = __sock_recvmsg(&iocb, sock, msg, size, flags); if (-EIOCBQUEUED == ret) ret = wait_on_sync_kiocb(&iocb); return ret; } +static void sock_aio_dtor(struct kiocb *iocb) +{ + kfree(iocb->private); +} + /* * Read data from a socket. ubuf is a user mode pointer. We make sure the user * area ubuf...ubuf+size-1 is writable before asking the protocol. @@ -598,7 +607,7 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg, static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, size_t size, loff_t pos) { - struct sock_iocb *x = kiocb_to_siocb(iocb); + struct sock_iocb *x, siocb; struct socket *sock; int flags; @@ -607,6 +616,16 @@ static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, if (size==0) /* Match SYS5 behaviour */ return 0; + if (is_sync_kiocb(iocb)) + x = &siocb; + else { + x = kmalloc(sizeof(struct sock_iocb), GFP_KERNEL); + if (!x) + return -ENOMEM; + iocb->ki_dtor = sock_aio_dtor; + } + iocb->private = x; + x->kiocb = iocb; sock = SOCKET_I(iocb->ki_filp->f_dentry->d_inode); x->async_msg.msg_name = NULL; @@ -631,7 +650,7 @@ static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t size, loff_t pos) { - struct sock_iocb *x = kiocb_to_siocb(iocb); + struct sock_iocb *x, siocb; struct socket *sock; if (pos != 0) @@ -639,6 +658,16 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf, if(size==0) /* Match SYS5 behaviour */ return 0; + if (is_sync_kiocb(iocb)) + x = &siocb; + else { + x = kmalloc(sizeof(struct sock_iocb), GFP_KERNEL); + if (!x) + return -ENOMEM; + iocb->ki_dtor = sock_aio_dtor; + } + iocb->private = x; + x->kiocb = iocb; sock = SOCKET_I(iocb->ki_filp->f_dentry->d_inode); x->async_msg.msg_name = NULL; -- cgit v1.2.3 From 1d6b84f35406f0ae71bd3fa7c2a0b8ceb0476684 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Sun, 27 Jun 2004 23:14:35 -0700 Subject: [DECNET]: Fix signed bug in net/decnet/dn_nsp_in.c:dn_nsp_linkservice() char can be either signed or unsigned, depending on the target system. Signed-off-by: Olaf Hering Signed-off-by: David S. Miller --- net/decnet/dn_nsp_in.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c index a77fa9fd1c79..05d84ed7e4e6 100644 --- a/net/decnet/dn_nsp_in.c +++ b/net/decnet/dn_nsp_in.c @@ -504,7 +504,7 @@ static void dn_nsp_linkservice(struct sock *sk, struct sk_buff *skb) struct dn_scp *scp = DN_SK(sk); unsigned short segnum; unsigned char lsflags; - char fcval; + signed char fcval; int wake_up = 0; char *ptr = skb->data; unsigned char fctype = scp->services_rem & NSP_FC_MASK; -- cgit v1.2.3 From 371135bd6e10d0d00a4437b5c7f75e231ef649ce Mon Sep 17 00:00:00 2001 From: Karsten Desler Date: Sun, 27 Jun 2004 23:15:54 -0700 Subject: [NET]: Fix typos in pktgen docs. --- Documentation/networking/pktgen.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/networking/pktgen.txt b/Documentation/networking/pktgen.txt index 776210590e85..99c1485d7b4a 100644 --- a/Documentation/networking/pktgen.txt +++ b/Documentation/networking/pktgen.txt @@ -11,13 +11,13 @@ How to use the Linux packet generator module. 5. After this two commands are defined: A. "pg" to start generator and to get results. B. "pgset" to change generator parameters. F.e. - pgset "clone_skb 100" sets the number of coppies of the same packet + pgset "clone_skb 100" sets the number of copies of the same packet will be sent before a new packet is allocated pgset "clone_skb 0" use multiple SKBs for packet generation pgset "pkt_size 9014" sets packet size to 9014 pgset "frags 5" packet will consist of 5 fragments pgset "count 200000" sets number of packets to send, set to zero - for continious sends untill explicitly + for continuous sends until explicitly stopped. pgset "ipg 5000" sets artificial gap inserted between packets to 5000 nanoseconds -- cgit v1.2.3 From 990a74c856d9ca257165f24b132d3392008590c1 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 28 Jun 2004 00:30:18 -0700 Subject: [PATCH] nfs oops fix Al's current changes to struct nameidata broke nfsroot for my discless clients (oops in nfs_fill_super). The patch below fixes this problem for me. Cc: Trond Myklebust Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/nfsctl.c | 1 + net/sunrpc/rpc_pipe.c | 1 + 2 files changed, 2 insertions(+) diff --git a/fs/nfsctl.c b/fs/nfsctl.c index 12472dd2a99d..aaf9f5640eb3 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c @@ -32,6 +32,7 @@ static struct file *do_open(char *name, int flags) nd.dentry = dget(nd.mnt->mnt_root); nd.last_type = LAST_ROOT; nd.flags = 0; + nd.depth = 0; error = path_walk(name, &nd); if (error) diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 8a8c4eb6c78a..95ce716823d8 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -433,6 +433,7 @@ rpc_lookup_parent(char *path, struct nameidata *nd) nd->dentry = dget(rpc_mount->mnt_root); nd->last_type = LAST_ROOT; nd->flags = LOOKUP_PARENT; + nd->depth = 0; if (path_walk(path, nd)) { printk(KERN_WARNING "%s: %s failed to find path %s\n", -- cgit v1.2.3 From a059a16dfa477877c5f323a6afcedee4c9d9fa92 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Mon, 28 Jun 2004 00:30:53 -0700 Subject: [PATCH] remove extraneous security_inode_setattr call in hugetlbfs remove extraneous security_inode_setattr call in hugetlbfs, it's already done by VFS. Signed-off-by: Chris Wright Signed-off-by: Linus Torvalds --- fs/hugetlbfs/inode.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index f2893bbc5480..85b3a8565a28 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -329,9 +329,6 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) if (error) goto out; - error = security_inode_setattr(dentry, attr); - if (error) - goto out; if (ia_valid & ATTR_SIZE) { error = -EINVAL; if (!(attr->ia_size & ~HPAGE_MASK)) -- cgit v1.2.3 From 34c8c09878c341f1f10216fdeb985d3244bf2f31 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Mon, 28 Jun 2004 00:31:48 -0700 Subject: [PATCH] move prototype for __get_vm_area() to a sane location There are currently two files besides mm/vmalloc.c that make use of that function: - arch/sh/kernel/cpu/sh4/sq.c which defined its own prototype locally risking not being in sync with the real function, and - arch/arm/kernel/module.c which has no prototype at all and cause build warnings. This fixes those issues --- arch/sh/kernel/cpu/sh4/sq.c | 2 -- include/linux/vmalloc.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c index 7a0eb521ee7f..3dfe1741d10c 100644 --- a/arch/sh/kernel/cpu/sh4/sq.c +++ b/arch/sh/kernel/cpu/sh4/sq.c @@ -34,8 +34,6 @@ static LIST_HEAD(sq_mapping_list); static spinlock_t sq_mapping_lock = SPIN_LOCK_UNLOCKED; -extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, unsigned long start, unsigned long end); - /** * sq_flush - Flush (prefetch) the store queue cache * diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index bad993c16531..8c68717810c3 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -36,6 +36,8 @@ extern void vunmap(void *addr); * Lowlevel-APIs (not for driver use!) */ extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); +extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, + unsigned long start, unsigned long end); extern struct vm_struct *remove_vm_area(void *addr); extern int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages); -- cgit v1.2.3