diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-27 12:43:41 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-07-27 12:43:41 -0400 |
| commit | fbf08efa0400ec51963666d4757b4c57e5096a3c (patch) | |
| tree | 8b4faae6993f22a885b87ce8f1572f8c19a05f41 | |
| parent | 2bdb5eb79bbb0403fd272d097b14ae649302b98d (diff) | |
| parent | 295dc39d941dc2ae53d5c170365af4c9d5c16212 (diff) | |
Merge branch 'vfs-for-3.16' of git://git.infradead.org/users/hch/vfs
Pull vfs fixes from Christoph Hellwig:
"A vfsmount leak fix, and a compile warning fix"
* 'vfs-for-3.16' of git://git.infradead.org/users/hch/vfs:
fs: umount on symlink leaks mnt count
direct-io: fix uninitialized warning in do_direct_IO()
| -rw-r--r-- | fs/direct-io.c | 14 | ||||
| -rw-r--r-- | fs/namei.c | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c index 98040ba388ac..194d0d122cae 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
| @@ -198,9 +198,8 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio) | |||
| 198 | * L1 cache. | 198 | * L1 cache. |
| 199 | */ | 199 | */ |
| 200 | static inline struct page *dio_get_page(struct dio *dio, | 200 | static inline struct page *dio_get_page(struct dio *dio, |
| 201 | struct dio_submit *sdio, size_t *from, size_t *to) | 201 | struct dio_submit *sdio) |
| 202 | { | 202 | { |
| 203 | int n; | ||
| 204 | if (dio_pages_present(sdio) == 0) { | 203 | if (dio_pages_present(sdio) == 0) { |
| 205 | int ret; | 204 | int ret; |
| 206 | 205 | ||
| @@ -209,10 +208,7 @@ static inline struct page *dio_get_page(struct dio *dio, | |||
| 209 | return ERR_PTR(ret); | 208 | return ERR_PTR(ret); |
| 210 | BUG_ON(dio_pages_present(sdio) == 0); | 209 | BUG_ON(dio_pages_present(sdio) == 0); |
| 211 | } | 210 | } |
| 212 | n = sdio->head++; | 211 | return dio->pages[sdio->head]; |
| 213 | *from = n ? 0 : sdio->from; | ||
| 214 | *to = (n == sdio->tail - 1) ? sdio->to : PAGE_SIZE; | ||
| 215 | return dio->pages[n]; | ||
| 216 | } | 212 | } |
| 217 | 213 | ||
| 218 | /** | 214 | /** |
| @@ -911,11 +907,15 @@ static int do_direct_IO(struct dio *dio, struct dio_submit *sdio, | |||
| 911 | while (sdio->block_in_file < sdio->final_block_in_request) { | 907 | while (sdio->block_in_file < sdio->final_block_in_request) { |
| 912 | struct page *page; | 908 | struct page *page; |
| 913 | size_t from, to; | 909 | size_t from, to; |
| 914 | page = dio_get_page(dio, sdio, &from, &to); | 910 | |
| 911 | page = dio_get_page(dio, sdio); | ||
| 915 | if (IS_ERR(page)) { | 912 | if (IS_ERR(page)) { |
| 916 | ret = PTR_ERR(page); | 913 | ret = PTR_ERR(page); |
| 917 | goto out; | 914 | goto out; |
| 918 | } | 915 | } |
| 916 | from = sdio->head ? 0 : sdio->from; | ||
| 917 | to = (sdio->head == sdio->tail - 1) ? sdio->to : PAGE_SIZE; | ||
| 918 | sdio->head++; | ||
| 919 | 919 | ||
| 920 | while (from < to) { | 920 | while (from < to) { |
| 921 | unsigned this_chunk_bytes; /* # of bytes mapped */ | 921 | unsigned this_chunk_bytes; /* # of bytes mapped */ |
diff --git a/fs/namei.c b/fs/namei.c index 985c6f368485..9eb787e5c167 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -2256,9 +2256,10 @@ done: | |||
| 2256 | goto out; | 2256 | goto out; |
| 2257 | } | 2257 | } |
| 2258 | path->dentry = dentry; | 2258 | path->dentry = dentry; |
| 2259 | path->mnt = mntget(nd->path.mnt); | 2259 | path->mnt = nd->path.mnt; |
| 2260 | if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW)) | 2260 | if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW)) |
| 2261 | return 1; | 2261 | return 1; |
| 2262 | mntget(path->mnt); | ||
| 2262 | follow_mount(path); | 2263 | follow_mount(path); |
| 2263 | error = 0; | 2264 | error = 0; |
| 2264 | out: | 2265 | out: |
