Skip to content

Commit fbf08ef

Browse files
committed
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()
2 parents 2bdb5eb + 295dc39 commit fbf08ef

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

fs/direct-io.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,8 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio)
198198
* L1 cache.
199199
*/
200200
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)
202202
{
203-
int n;
204203
if (dio_pages_present(sdio) == 0) {
205204
int ret;
206205

@@ -209,10 +208,7 @@ static inline struct page *dio_get_page(struct dio *dio,
209208
return ERR_PTR(ret);
210209
BUG_ON(dio_pages_present(sdio) == 0);
211210
}
212-
n = sdio->head++;
213-
*from = n ? 0 : sdio->from;
214-
*to = (n == sdio->tail - 1) ? sdio->to : PAGE_SIZE;
215-
return dio->pages[n];
211+
return dio->pages[sdio->head];
216212
}
217213

218214
/**
@@ -911,11 +907,15 @@ static int do_direct_IO(struct dio *dio, struct dio_submit *sdio,
911907
while (sdio->block_in_file < sdio->final_block_in_request) {
912908
struct page *page;
913909
size_t from, to;
914-
page = dio_get_page(dio, sdio, &from, &to);
910+
911+
page = dio_get_page(dio, sdio);
915912
if (IS_ERR(page)) {
916913
ret = PTR_ERR(page);
917914
goto out;
918915
}
916+
from = sdio->head ? 0 : sdio->from;
917+
to = (sdio->head == sdio->tail - 1) ? sdio->to : PAGE_SIZE;
918+
sdio->head++;
919919

920920
while (from < to) {
921921
unsigned this_chunk_bytes; /* # of bytes mapped */

fs/namei.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,9 +2256,10 @@ mountpoint_last(struct nameidata *nd, struct path *path)
22562256
goto out;
22572257
}
22582258
path->dentry = dentry;
2259-
path->mnt = mntget(nd->path.mnt);
2259+
path->mnt = nd->path.mnt;
22602260
if (should_follow_link(dentry, nd->flags & LOOKUP_FOLLOW))
22612261
return 1;
2262+
mntget(path->mnt);
22622263
follow_mount(path);
22632264
error = 0;
22642265
out:

0 commit comments

Comments
 (0)