diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback_proc.c | 2 | ||||
-rw-r--r-- | fs/nfs/dir.c | 16 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 18 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 2 | ||||
-rw-r--r-- | fs/nfs/read.c | 10 | ||||
-rw-r--r-- | fs/nfs/super.c | 2 | ||||
-rw-r--r-- | fs/nfs/write.c | 10 |
7 files changed, 38 insertions, 22 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index c89b26bc9759..264d1aa935f2 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -206,7 +206,7 @@ static u32 initiate_bulk_draining(struct nfs_client *clp, | |||
206 | 206 | ||
207 | list_for_each_entry(lo, &server->layouts, plh_layouts) { | 207 | list_for_each_entry(lo, &server->layouts, plh_layouts) { |
208 | ino = igrab(lo->plh_inode); | 208 | ino = igrab(lo->plh_inode); |
209 | if (ino) | 209 | if (!ino) |
210 | continue; | 210 | continue; |
211 | spin_lock(&ino->i_lock); | 211 | spin_lock(&ino->i_lock); |
212 | /* Is this layout in the process of being freed? */ | 212 | /* Is this layout in the process of being freed? */ |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 32e6c53520e2..1b2d7eb93796 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -2153,12 +2153,16 @@ static int nfs_open_permission_mask(int openflags) | |||
2153 | { | 2153 | { |
2154 | int mask = 0; | 2154 | int mask = 0; |
2155 | 2155 | ||
2156 | if ((openflags & O_ACCMODE) != O_WRONLY) | 2156 | if (openflags & __FMODE_EXEC) { |
2157 | mask |= MAY_READ; | 2157 | /* ONLY check exec rights */ |
2158 | if ((openflags & O_ACCMODE) != O_RDONLY) | 2158 | mask = MAY_EXEC; |
2159 | mask |= MAY_WRITE; | 2159 | } else { |
2160 | if (openflags & __FMODE_EXEC) | 2160 | if ((openflags & O_ACCMODE) != O_WRONLY) |
2161 | mask |= MAY_EXEC; | 2161 | mask |= MAY_READ; |
2162 | if ((openflags & O_ACCMODE) != O_RDONLY) | ||
2163 | mask |= MAY_WRITE; | ||
2164 | } | ||
2165 | |||
2162 | return mask; | 2166 | return mask; |
2163 | } | 2167 | } |
2164 | 2168 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 5d864fb36578..cf747ef86650 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1626,7 +1626,8 @@ static int _nfs4_recover_proc_open(struct nfs4_opendata *data) | |||
1626 | 1626 | ||
1627 | static int nfs4_opendata_access(struct rpc_cred *cred, | 1627 | static int nfs4_opendata_access(struct rpc_cred *cred, |
1628 | struct nfs4_opendata *opendata, | 1628 | struct nfs4_opendata *opendata, |
1629 | struct nfs4_state *state, fmode_t fmode) | 1629 | struct nfs4_state *state, fmode_t fmode, |
1630 | int openflags) | ||
1630 | { | 1631 | { |
1631 | struct nfs_access_entry cache; | 1632 | struct nfs_access_entry cache; |
1632 | u32 mask; | 1633 | u32 mask; |
@@ -1638,11 +1639,14 @@ static int nfs4_opendata_access(struct rpc_cred *cred, | |||
1638 | 1639 | ||
1639 | mask = 0; | 1640 | mask = 0; |
1640 | /* don't check MAY_WRITE - a newly created file may not have | 1641 | /* don't check MAY_WRITE - a newly created file may not have |
1641 | * write mode bits, but POSIX allows the creating process to write */ | 1642 | * write mode bits, but POSIX allows the creating process to write. |
1642 | if (fmode & FMODE_READ) | 1643 | * use openflags to check for exec, because fmode won't |
1643 | mask |= MAY_READ; | 1644 | * always have FMODE_EXEC set when file open for exec. */ |
1644 | if (fmode & FMODE_EXEC) | 1645 | if (openflags & __FMODE_EXEC) { |
1645 | mask |= MAY_EXEC; | 1646 | /* ONLY check for exec rights */ |
1647 | mask = MAY_EXEC; | ||
1648 | } else if (fmode & FMODE_READ) | ||
1649 | mask = MAY_READ; | ||
1646 | 1650 | ||
1647 | cache.cred = cred; | 1651 | cache.cred = cred; |
1648 | cache.jiffies = jiffies; | 1652 | cache.jiffies = jiffies; |
@@ -1896,7 +1900,7 @@ static int _nfs4_do_open(struct inode *dir, | |||
1896 | if (server->caps & NFS_CAP_POSIX_LOCK) | 1900 | if (server->caps & NFS_CAP_POSIX_LOCK) |
1897 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); | 1901 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); |
1898 | 1902 | ||
1899 | status = nfs4_opendata_access(cred, opendata, state, fmode); | 1903 | status = nfs4_opendata_access(cred, opendata, state, fmode, flags); |
1900 | if (status != 0) | 1904 | if (status != 0) |
1901 | goto err_opendata_put; | 1905 | goto err_opendata_put; |
1902 | 1906 | ||
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index e7165d915362..d00260b08103 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -254,7 +254,7 @@ static void | |||
254 | pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit) | 254 | pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit) |
255 | { | 255 | { |
256 | lo->plh_retry_timestamp = jiffies; | 256 | lo->plh_retry_timestamp = jiffies; |
257 | if (test_and_set_bit(fail_bit, &lo->plh_flags)) | 257 | if (!test_and_set_bit(fail_bit, &lo->plh_flags)) |
258 | atomic_inc(&lo->plh_refcount); | 258 | atomic_inc(&lo->plh_refcount); |
259 | } | 259 | } |
260 | 260 | ||
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index b6bdb18e892c..a5e5d9899d56 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -91,12 +91,16 @@ void nfs_readdata_release(struct nfs_read_data *rdata) | |||
91 | put_nfs_open_context(rdata->args.context); | 91 | put_nfs_open_context(rdata->args.context); |
92 | if (rdata->pages.pagevec != rdata->pages.page_array) | 92 | if (rdata->pages.pagevec != rdata->pages.page_array) |
93 | kfree(rdata->pages.pagevec); | 93 | kfree(rdata->pages.pagevec); |
94 | if (rdata != &read_header->rpc_data) | 94 | if (rdata == &read_header->rpc_data) { |
95 | kfree(rdata); | ||
96 | else | ||
97 | rdata->header = NULL; | 95 | rdata->header = NULL; |
96 | rdata = NULL; | ||
97 | } | ||
98 | if (atomic_dec_and_test(&hdr->refcnt)) | 98 | if (atomic_dec_and_test(&hdr->refcnt)) |
99 | hdr->completion_ops->completion(hdr); | 99 | hdr->completion_ops->completion(hdr); |
100 | /* Note: we only free the rpc_task after callbacks are done. | ||
101 | * See the comment in rpc_free_task() for why | ||
102 | */ | ||
103 | kfree(rdata); | ||
100 | } | 104 | } |
101 | EXPORT_SYMBOL_GPL(nfs_readdata_release); | 105 | EXPORT_SYMBOL_GPL(nfs_readdata_release); |
102 | 106 | ||
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index c25cadf8f8c4..2e7e8c878e5d 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -1152,7 +1152,7 @@ static int nfs_get_option_str(substring_t args[], char **option) | |||
1152 | { | 1152 | { |
1153 | kfree(*option); | 1153 | kfree(*option); |
1154 | *option = match_strdup(args); | 1154 | *option = match_strdup(args); |
1155 | return !option; | 1155 | return !*option; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | static int nfs_get_option_ul(substring_t args[], unsigned long *option) | 1158 | static int nfs_get_option_ul(substring_t args[], unsigned long *option) |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index b673be31590e..c483cc50b82e 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -126,12 +126,16 @@ void nfs_writedata_release(struct nfs_write_data *wdata) | |||
126 | put_nfs_open_context(wdata->args.context); | 126 | put_nfs_open_context(wdata->args.context); |
127 | if (wdata->pages.pagevec != wdata->pages.page_array) | 127 | if (wdata->pages.pagevec != wdata->pages.page_array) |
128 | kfree(wdata->pages.pagevec); | 128 | kfree(wdata->pages.pagevec); |
129 | if (wdata != &write_header->rpc_data) | 129 | if (wdata == &write_header->rpc_data) { |
130 | kfree(wdata); | ||
131 | else | ||
132 | wdata->header = NULL; | 130 | wdata->header = NULL; |
131 | wdata = NULL; | ||
132 | } | ||
133 | if (atomic_dec_and_test(&hdr->refcnt)) | 133 | if (atomic_dec_and_test(&hdr->refcnt)) |
134 | hdr->completion_ops->completion(hdr); | 134 | hdr->completion_ops->completion(hdr); |
135 | /* Note: we only free the rpc_task after callbacks are done. | ||
136 | * See the comment in rpc_free_task() for why | ||
137 | */ | ||
138 | kfree(wdata); | ||
135 | } | 139 | } |
136 | EXPORT_SYMBOL_GPL(nfs_writedata_release); | 140 | EXPORT_SYMBOL_GPL(nfs_writedata_release); |
137 | 141 | ||