Browse Source

Merge branch 'for_linus' of git://git.linux-nfs.org/pub/linux/nfs-2.6

Linus Torvalds 17 years ago
parent
commit
b1330031b7
6 changed files with 59 additions and 14 deletions
  1. 1 1
      fs/nfs/file.c
  2. 1 1
      fs/nfs/namespace.c
  3. 2 2
      fs/nfs/nfs4proc.c
  4. 10 10
      fs/nfs/super.c
  5. 44 0
      fs/nfs/write.c
  6. 1 0
      include/linux/nfs_fs.h

+ 1 - 1
fs/nfs/file.c

@@ -316,7 +316,7 @@ static void nfs_invalidate_page(struct page *page, unsigned long offset)
 	if (offset != 0)
 	if (offset != 0)
 		return;
 		return;
 	/* Cancel any unstarted writes on this page */
 	/* Cancel any unstarted writes on this page */
-	nfs_wb_page_priority(page->mapping->host, page, FLUSH_INVALIDATE);
+	nfs_wb_page_cancel(page->mapping->host, page);
 }
 }
 
 
 static int nfs_release_page(struct page *page, gfp_t gfp)
 static int nfs_release_page(struct page *page, gfp_t gfp)

+ 1 - 1
fs/nfs/namespace.c

@@ -176,7 +176,7 @@ static void nfs_expire_automounts(struct work_struct *work)
 void nfs_release_automount_timer(void)
 void nfs_release_automount_timer(void)
 {
 {
 	if (list_empty(&nfs_automount_list))
 	if (list_empty(&nfs_automount_list))
-		cancel_delayed_work_sync(&nfs_automount_task);
+		cancel_delayed_work(&nfs_automount_task);
 }
 }
 
 
 /*
 /*

+ 2 - 2
fs/nfs/nfs4proc.c

@@ -646,7 +646,7 @@ static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
 	rcu_read_lock();
 	rcu_read_lock();
 	delegation = rcu_dereference(NFS_I(state->inode)->delegation);
 	delegation = rcu_dereference(NFS_I(state->inode)->delegation);
 	if (delegation != NULL && (delegation->flags & NFS_DELEGATION_NEED_RECLAIM) != 0)
 	if (delegation != NULL && (delegation->flags & NFS_DELEGATION_NEED_RECLAIM) != 0)
-		delegation_type = delegation->flags;
+		delegation_type = delegation->type;
 	rcu_read_unlock();
 	rcu_read_unlock();
 	opendata->o_arg.u.delegation_type = delegation_type;
 	opendata->o_arg.u.delegation_type = delegation_type;
 	status = nfs4_open_recover(opendata, state);
 	status = nfs4_open_recover(opendata, state);
@@ -1434,7 +1434,7 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
 	}
 	}
 	res = d_add_unique(dentry, igrab(state->inode));
 	res = d_add_unique(dentry, igrab(state->inode));
 	if (res != NULL)
 	if (res != NULL)
-		dentry = res;
+		path.dentry = res;
 	nfs4_intent_set_file(nd, &path, state);
 	nfs4_intent_set_file(nd, &path, state);
 	return res;
 	return res;
 }
 }

+ 10 - 10
fs/nfs/super.c

@@ -911,13 +911,13 @@ static int nfs_parse_mount_options(char *raw,
 			kfree(string);
 			kfree(string);
 
 
 			switch (token) {
 			switch (token) {
-			case Opt_udp:
+			case Opt_xprt_udp:
 				mnt->flags &= ~NFS_MOUNT_TCP;
 				mnt->flags &= ~NFS_MOUNT_TCP;
 				mnt->nfs_server.protocol = IPPROTO_UDP;
 				mnt->nfs_server.protocol = IPPROTO_UDP;
 				mnt->timeo = 7;
 				mnt->timeo = 7;
 				mnt->retrans = 5;
 				mnt->retrans = 5;
 				break;
 				break;
-			case Opt_tcp:
+			case Opt_xprt_tcp:
 				mnt->flags |= NFS_MOUNT_TCP;
 				mnt->flags |= NFS_MOUNT_TCP;
 				mnt->nfs_server.protocol = IPPROTO_TCP;
 				mnt->nfs_server.protocol = IPPROTO_TCP;
 				mnt->timeo = 600;
 				mnt->timeo = 600;
@@ -936,10 +936,10 @@ static int nfs_parse_mount_options(char *raw,
 			kfree(string);
 			kfree(string);
 
 
 			switch (token) {
 			switch (token) {
-			case Opt_udp:
+			case Opt_xprt_udp:
 				mnt->mount_server.protocol = IPPROTO_UDP;
 				mnt->mount_server.protocol = IPPROTO_UDP;
 				break;
 				break;
-			case Opt_tcp:
+			case Opt_xprt_tcp:
 				mnt->mount_server.protocol = IPPROTO_TCP;
 				mnt->mount_server.protocol = IPPROTO_TCP;
 				break;
 				break;
 			default:
 			default:
@@ -1153,20 +1153,20 @@ static int nfs_validate_mount_data(struct nfs_mount_data **options,
 		c = strchr(dev_name, ':');
 		c = strchr(dev_name, ':');
 		if (c == NULL)
 		if (c == NULL)
 			return -EINVAL;
 			return -EINVAL;
-		len = c - dev_name - 1;
+		len = c - dev_name;
 		if (len > sizeof(data->hostname))
 		if (len > sizeof(data->hostname))
-			return -EINVAL;
+			return -ENAMETOOLONG;
 		strncpy(data->hostname, dev_name, len);
 		strncpy(data->hostname, dev_name, len);
 		args.nfs_server.hostname = data->hostname;
 		args.nfs_server.hostname = data->hostname;
 
 
 		c++;
 		c++;
 		if (strlen(c) > NFS_MAXPATHLEN)
 		if (strlen(c) > NFS_MAXPATHLEN)
-			return -EINVAL;
+			return -ENAMETOOLONG;
 		args.nfs_server.export_path = c;
 		args.nfs_server.export_path = c;
 
 
 		status = nfs_try_mount(&args, mntfh);
 		status = nfs_try_mount(&args, mntfh);
 		if (status)
 		if (status)
-			return -EINVAL;
+			return status;
 
 
 		/*
 		/*
 		 * Translate to nfs_mount_data, which nfs_fill_super
 		 * Translate to nfs_mount_data, which nfs_fill_super
@@ -1677,7 +1677,7 @@ static int nfs4_validate_mount_data(struct nfs4_mount_data **options,
 		/* while calculating len, pretend ':' is '\0' */
 		/* while calculating len, pretend ':' is '\0' */
 		len = c - dev_name;
 		len = c - dev_name;
 		if (len > NFS4_MAXNAMLEN)
 		if (len > NFS4_MAXNAMLEN)
-			return -EINVAL;
+			return -ENAMETOOLONG;
 		*hostname = kzalloc(len, GFP_KERNEL);
 		*hostname = kzalloc(len, GFP_KERNEL);
 		if (*hostname == NULL)
 		if (*hostname == NULL)
 			return -ENOMEM;
 			return -ENOMEM;
@@ -1686,7 +1686,7 @@ static int nfs4_validate_mount_data(struct nfs4_mount_data **options,
 		c++;			/* step over the ':' */
 		c++;			/* step over the ':' */
 		len = strlen(c);
 		len = strlen(c);
 		if (len > NFS4_MAXPATHLEN)
 		if (len > NFS4_MAXPATHLEN)
-			return -EINVAL;
+			return -ENAMETOOLONG;
 		*mntpath = kzalloc(len + 1, GFP_KERNEL);
 		*mntpath = kzalloc(len + 1, GFP_KERNEL);
 		if (*mntpath == NULL)
 		if (*mntpath == NULL)
 			return -ENOMEM;
 			return -ENOMEM;

+ 44 - 0
fs/nfs/write.c

@@ -1396,6 +1396,50 @@ out:
 	return ret;
 	return ret;
 }
 }
 
 
+int nfs_wb_page_cancel(struct inode *inode, struct page *page)
+{
+	struct nfs_page *req;
+	loff_t range_start = page_offset(page);
+	loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
+	struct writeback_control wbc = {
+		.bdi = page->mapping->backing_dev_info,
+		.sync_mode = WB_SYNC_ALL,
+		.nr_to_write = LONG_MAX,
+		.range_start = range_start,
+		.range_end = range_end,
+	};
+	int ret = 0;
+
+	BUG_ON(!PageLocked(page));
+	for (;;) {
+		req = nfs_page_find_request(page);
+		if (req == NULL)
+			goto out;
+		if (test_bit(PG_NEED_COMMIT, &req->wb_flags)) {
+			nfs_release_request(req);
+			break;
+		}
+		if (nfs_lock_request_dontget(req)) {
+			nfs_inode_remove_request(req);
+			/*
+			 * In case nfs_inode_remove_request has marked the
+			 * page as being dirty
+			 */
+			cancel_dirty_page(page, PAGE_CACHE_SIZE);
+			nfs_unlock_request(req);
+			break;
+		}
+		ret = nfs_wait_on_request(req);
+		if (ret < 0)
+			goto out;
+	}
+	if (!PagePrivate(page))
+		return 0;
+	ret = nfs_sync_mapping_wait(page->mapping, &wbc, FLUSH_INVALIDATE);
+out:
+	return ret;
+}
+
 int nfs_wb_page_priority(struct inode *inode, struct page *page, int how)
 int nfs_wb_page_priority(struct inode *inode, struct page *page, int how)
 {
 {
 	loff_t range_start = page_offset(page);
 	loff_t range_start = page_offset(page);

+ 1 - 0
include/linux/nfs_fs.h

@@ -431,6 +431,7 @@ extern int nfs_sync_mapping_range(struct address_space *, loff_t, loff_t, int);
 extern int nfs_wb_all(struct inode *inode);
 extern int nfs_wb_all(struct inode *inode);
 extern int nfs_wb_page(struct inode *inode, struct page* page);
 extern int nfs_wb_page(struct inode *inode, struct page* page);
 extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
 extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
+extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
 #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
 #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
 extern int  nfs_commit_inode(struct inode *, int);
 extern int  nfs_commit_inode(struct inode *, int);
 extern struct nfs_write_data *nfs_commit_alloc(void);
 extern struct nfs_write_data *nfs_commit_alloc(void);