Browse Source

Merge branch 'hotfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6

* 'hotfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
  SUNRPC: Fix a memory leak in rpc_create()
  fix bug - executing FDPIC ELF on NFS mount triggers BUG() at mm/nommu.c:862:/do_mmap_private()
  NFS: initialize flags field in nfs_open_context
  SUNRPC: don't call flush_dcache_page() with an invalid pointer
Linus Torvalds 17 years ago
parent
commit
098107a01a
4 changed files with 11 additions and 7 deletions
  1. 4 0
      fs/nfs/file.c
  2. 1 0
      fs/nfs/inode.c
  3. 0 4
      net/sunrpc/clnt.c
  4. 6 3
      net/sunrpc/xdr.c

+ 4 - 0
fs/nfs/file.c

@@ -64,7 +64,11 @@ const struct file_operations nfs_file_operations = {
 	.write		= do_sync_write,
 	.write		= do_sync_write,
 	.aio_read	= nfs_file_read,
 	.aio_read	= nfs_file_read,
 	.aio_write	= nfs_file_write,
 	.aio_write	= nfs_file_write,
+#ifdef CONFIG_MMU
 	.mmap		= nfs_file_mmap,
 	.mmap		= nfs_file_mmap,
+#else
+	.mmap		= generic_file_mmap,
+#endif
 	.open		= nfs_file_open,
 	.open		= nfs_file_open,
 	.flush		= nfs_file_flush,
 	.flush		= nfs_file_flush,
 	.release	= nfs_file_release,
 	.release	= nfs_file_release,

+ 1 - 0
fs/nfs/inode.c

@@ -506,6 +506,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
 		ctx->cred = get_rpccred(cred);
 		ctx->cred = get_rpccred(cred);
 		ctx->state = NULL;
 		ctx->state = NULL;
 		ctx->lockowner = current->files;
 		ctx->lockowner = current->files;
+		ctx->flags = 0;
 		ctx->error = 0;
 		ctx->error = 0;
 		ctx->dir_cookie = 0;
 		ctx->dir_cookie = 0;
 		atomic_set(&ctx->count, 1);
 		atomic_set(&ctx->count, 1);

+ 0 - 4
net/sunrpc/clnt.c

@@ -261,10 +261,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
 	};
 	};
 	char servername[48];
 	char servername[48];
 
 
-	xprt = xprt_create_transport(&xprtargs);
-	if (IS_ERR(xprt))
-		return (struct rpc_clnt *)xprt;
-
 	/*
 	/*
 	 * If the caller chooses not to specify a hostname, whip
 	 * If the caller chooses not to specify a hostname, whip
 	 * up a string representation of the passed-in address.
 	 * up a string representation of the passed-in address.

+ 6 - 3
net/sunrpc/xdr.c

@@ -244,7 +244,7 @@ _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len)
 	pgto = pages + (pgbase >> PAGE_CACHE_SHIFT);
 	pgto = pages + (pgbase >> PAGE_CACHE_SHIFT);
 	pgbase &= ~PAGE_CACHE_MASK;
 	pgbase &= ~PAGE_CACHE_MASK;
 
 
-	do {
+	for (;;) {
 		copy = PAGE_CACHE_SIZE - pgbase;
 		copy = PAGE_CACHE_SIZE - pgbase;
 		if (copy > len)
 		if (copy > len)
 			copy = len;
 			copy = len;
@@ -253,6 +253,10 @@ _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len)
 		memcpy(vto + pgbase, p, copy);
 		memcpy(vto + pgbase, p, copy);
 		kunmap_atomic(vto, KM_USER0);
 		kunmap_atomic(vto, KM_USER0);
 
 
+		len -= copy;
+		if (len == 0)
+			break;
+
 		pgbase += copy;
 		pgbase += copy;
 		if (pgbase == PAGE_CACHE_SIZE) {
 		if (pgbase == PAGE_CACHE_SIZE) {
 			flush_dcache_page(*pgto);
 			flush_dcache_page(*pgto);
@@ -260,8 +264,7 @@ _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len)
 			pgto++;
 			pgto++;
 		}
 		}
 		p += copy;
 		p += copy;
-
-	} while ((len -= copy) != 0);
+	}
 	flush_dcache_page(*pgto);
 	flush_dcache_page(*pgto);
 }
 }