diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/super.c | 1 | ||||
-rw-r--r-- | fs/pipe.c | 41 |
2 files changed, 31 insertions, 11 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index a2c18acb8568..90be551b80c1 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -1253,6 +1253,7 @@ static int nfs_parse_mount_options(char *raw, | |||
1253 | default: | 1253 | default: |
1254 | dfprintk(MOUNT, "NFS: unrecognized " | 1254 | dfprintk(MOUNT, "NFS: unrecognized " |
1255 | "transport protocol\n"); | 1255 | "transport protocol\n"); |
1256 | kfree(string); | ||
1256 | return 0; | 1257 | return 0; |
1257 | } | 1258 | } |
1258 | break; | 1259 | break; |
@@ -777,36 +777,55 @@ pipe_rdwr_release(struct inode *inode, struct file *filp) | |||
777 | static int | 777 | static int |
778 | pipe_read_open(struct inode *inode, struct file *filp) | 778 | pipe_read_open(struct inode *inode, struct file *filp) |
779 | { | 779 | { |
780 | /* We could have perhaps used atomic_t, but this and friends | 780 | int ret = -ENOENT; |
781 | below are the only places. So it doesn't seem worthwhile. */ | 781 | |
782 | mutex_lock(&inode->i_mutex); | 782 | mutex_lock(&inode->i_mutex); |
783 | inode->i_pipe->readers++; | 783 | |
784 | if (inode->i_pipe) { | ||
785 | ret = 0; | ||
786 | inode->i_pipe->readers++; | ||
787 | } | ||
788 | |||
784 | mutex_unlock(&inode->i_mutex); | 789 | mutex_unlock(&inode->i_mutex); |
785 | 790 | ||
786 | return 0; | 791 | return ret; |
787 | } | 792 | } |
788 | 793 | ||
789 | static int | 794 | static int |
790 | pipe_write_open(struct inode *inode, struct file *filp) | 795 | pipe_write_open(struct inode *inode, struct file *filp) |
791 | { | 796 | { |
797 | int ret = -ENOENT; | ||
798 | |||
792 | mutex_lock(&inode->i_mutex); | 799 | mutex_lock(&inode->i_mutex); |
793 | inode->i_pipe->writers++; | 800 | |
801 | if (inode->i_pipe) { | ||
802 | ret = 0; | ||
803 | inode->i_pipe->writers++; | ||
804 | } | ||
805 | |||
794 | mutex_unlock(&inode->i_mutex); | 806 | mutex_unlock(&inode->i_mutex); |
795 | 807 | ||
796 | return 0; | 808 | return ret; |
797 | } | 809 | } |
798 | 810 | ||
799 | static int | 811 | static int |
800 | pipe_rdwr_open(struct inode *inode, struct file *filp) | 812 | pipe_rdwr_open(struct inode *inode, struct file *filp) |
801 | { | 813 | { |
814 | int ret = -ENOENT; | ||
815 | |||
802 | mutex_lock(&inode->i_mutex); | 816 | mutex_lock(&inode->i_mutex); |
803 | if (filp->f_mode & FMODE_READ) | 817 | |
804 | inode->i_pipe->readers++; | 818 | if (inode->i_pipe) { |
805 | if (filp->f_mode & FMODE_WRITE) | 819 | ret = 0; |
806 | inode->i_pipe->writers++; | 820 | if (filp->f_mode & FMODE_READ) |
821 | inode->i_pipe->readers++; | ||
822 | if (filp->f_mode & FMODE_WRITE) | ||
823 | inode->i_pipe->writers++; | ||
824 | } | ||
825 | |||
807 | mutex_unlock(&inode->i_mutex); | 826 | mutex_unlock(&inode->i_mutex); |
808 | 827 | ||
809 | return 0; | 828 | return ret; |
810 | } | 829 | } |
811 | 830 | ||
812 | /* | 831 | /* |