aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-12 17:49:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-12 17:49:50 -0400
commit5166701b368caea89d57b14bf41cf39e819dad51 (patch)
treec73b9d4860809e3afa9359be9d03ba2d8d98a18e /fs/ncpfs
parent0a7418f5f569512e98789c439198eed4b507cce3 (diff)
parenta786c06d9f2719203c00b3d97b21f9a96980d0b5 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "The first vfs pile, with deep apologies for being very late in this window. Assorted cleanups and fixes, plus a large preparatory part of iov_iter work. There's a lot more of that, but it'll probably go into the next merge window - it *does* shape up nicely, removes a lot of boilerplate, gets rid of locking inconsistencie between aio_write and splice_write and I hope to get Kent's direct-io rewrite merged into the same queue, but some of the stuff after this point is having (mostly trivial) conflicts with the things already merged into mainline and with some I want more testing. This one passes LTP and xfstests without regressions, in addition to usual beating. BTW, readahead02 in ltp syscalls testsuite has started giving failures since "mm/readahead.c: fix readahead failure for memoryless NUMA nodes and limit readahead pages" - might be a false positive, might be a real regression..." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits) missing bits of "splice: fix racy pipe->buffers uses" cifs: fix the race in cifs_writev() ceph_sync_{,direct_}write: fix an oops on ceph_osdc_new_request() failure kill generic_file_buffered_write() ocfs2_file_aio_write(): switch to generic_perform_write() ceph_aio_write(): switch to generic_perform_write() xfs_file_buffered_aio_write(): switch to generic_perform_write() export generic_perform_write(), start getting rid of generic_file_buffer_write() generic_file_direct_write(): get rid of ppos argument btrfs_file_aio_write(): get rid of ppos kill the 5th argument of generic_file_buffered_write() kill the 4th argument of __generic_file_aio_write() lustre: don't open-code kernel_recvmsg() ocfs2: don't open-code kernel_recvmsg() drbd: don't open-code kernel_recvmsg() constify blk_rq_map_user_iov() and friends lustre: switch to kernel_sendmsg() ocfs2: don't open-code kernel_sendmsg() take iov_iter stuff to mm/iov_iter.c process_vm_access: tidy up a bit ...
Diffstat (limited to 'fs/ncpfs')
-rw-r--r--fs/ncpfs/inode.c50
-rw-r--r--fs/ncpfs/ncp_fs_sb.h2
2 files changed, 12 insertions, 40 deletions
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 81b4f643ecef..e31e589369a4 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -470,9 +470,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
470{ 470{
471 struct ncp_mount_data_kernel data; 471 struct ncp_mount_data_kernel data;
472 struct ncp_server *server; 472 struct ncp_server *server;
473 struct file *ncp_filp;
474 struct inode *root_inode; 473 struct inode *root_inode;
475 struct inode *sock_inode;
476 struct socket *sock; 474 struct socket *sock;
477 int error; 475 int error;
478 int default_bufsize; 476 int default_bufsize;
@@ -541,18 +539,10 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
541 if (!uid_valid(data.mounted_uid) || !uid_valid(data.uid) || 539 if (!uid_valid(data.mounted_uid) || !uid_valid(data.uid) ||
542 !gid_valid(data.gid)) 540 !gid_valid(data.gid))
543 goto out; 541 goto out;
544 error = -EBADF; 542 sock = sockfd_lookup(data.ncp_fd, &error);
545 ncp_filp = fget(data.ncp_fd);
546 if (!ncp_filp)
547 goto out;
548 error = -ENOTSOCK;
549 sock_inode = file_inode(ncp_filp);
550 if (!S_ISSOCK(sock_inode->i_mode))
551 goto out_fput;
552 sock = SOCKET_I(sock_inode);
553 if (!sock) 543 if (!sock)
554 goto out_fput; 544 goto out;
555 545
556 if (sock->type == SOCK_STREAM) 546 if (sock->type == SOCK_STREAM)
557 default_bufsize = 0xF000; 547 default_bufsize = 0xF000;
558 else 548 else
@@ -574,27 +564,16 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
574 if (error) 564 if (error)
575 goto out_fput; 565 goto out_fput;
576 566
577 server->ncp_filp = ncp_filp;
578 server->ncp_sock = sock; 567 server->ncp_sock = sock;
579 568
580 if (data.info_fd != -1) { 569 if (data.info_fd != -1) {
581 struct socket *info_sock; 570 struct socket *info_sock = sockfd_lookup(data.info_fd, &error);
582
583 error = -EBADF;
584 server->info_filp = fget(data.info_fd);
585 if (!server->info_filp)
586 goto out_bdi;
587 error = -ENOTSOCK;
588 sock_inode = file_inode(server->info_filp);
589 if (!S_ISSOCK(sock_inode->i_mode))
590 goto out_fput2;
591 info_sock = SOCKET_I(sock_inode);
592 if (!info_sock) 571 if (!info_sock)
593 goto out_fput2; 572 goto out_bdi;
573 server->info_sock = info_sock;
594 error = -EBADFD; 574 error = -EBADFD;
595 if (info_sock->type != SOCK_STREAM) 575 if (info_sock->type != SOCK_STREAM)
596 goto out_fput2; 576 goto out_fput2;
597 server->info_sock = info_sock;
598 } 577 }
599 578
600/* server->lock = 0; */ 579/* server->lock = 0; */
@@ -766,17 +745,12 @@ out_nls:
766 mutex_destroy(&server->root_setup_lock); 745 mutex_destroy(&server->root_setup_lock);
767 mutex_destroy(&server->mutex); 746 mutex_destroy(&server->mutex);
768out_fput2: 747out_fput2:
769 if (server->info_filp) 748 if (server->info_sock)
770 fput(server->info_filp); 749 sockfd_put(server->info_sock);
771out_bdi: 750out_bdi:
772 bdi_destroy(&server->bdi); 751 bdi_destroy(&server->bdi);
773out_fput: 752out_fput:
774 /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: 753 sockfd_put(sock);
775 *
776 * The previously used put_filp(ncp_filp); was bogus, since
777 * it doesn't perform proper unlocking.
778 */
779 fput(ncp_filp);
780out: 754out:
781 put_pid(data.wdog_pid); 755 put_pid(data.wdog_pid);
782 sb->s_fs_info = NULL; 756 sb->s_fs_info = NULL;
@@ -809,9 +783,9 @@ static void ncp_put_super(struct super_block *sb)
809 mutex_destroy(&server->root_setup_lock); 783 mutex_destroy(&server->root_setup_lock);
810 mutex_destroy(&server->mutex); 784 mutex_destroy(&server->mutex);
811 785
812 if (server->info_filp) 786 if (server->info_sock)
813 fput(server->info_filp); 787 sockfd_put(server->info_sock);
814 fput(server->ncp_filp); 788 sockfd_put(server->ncp_sock);
815 kill_pid(server->m.wdog_pid, SIGTERM, 1); 789 kill_pid(server->m.wdog_pid, SIGTERM, 1);
816 put_pid(server->m.wdog_pid); 790 put_pid(server->m.wdog_pid);
817 791
diff --git a/fs/ncpfs/ncp_fs_sb.h b/fs/ncpfs/ncp_fs_sb.h
index b81e97adc5a9..7fa17e459366 100644
--- a/fs/ncpfs/ncp_fs_sb.h
+++ b/fs/ncpfs/ncp_fs_sb.h
@@ -45,9 +45,7 @@ struct ncp_server {
45 45
46 __u8 name_space[NCP_NUMBER_OF_VOLUMES + 2]; 46 __u8 name_space[NCP_NUMBER_OF_VOLUMES + 2];
47 47
48 struct file *ncp_filp; /* File pointer to ncp socket */
49 struct socket *ncp_sock;/* ncp socket */ 48 struct socket *ncp_sock;/* ncp socket */
50 struct file *info_filp;
51 struct socket *info_sock; 49 struct socket *info_sock;
52 50
53 u8 sequence; 51 u8 sequence;