Changes in gfs2:
- Fix a bug in Abhi Das's journal head lookup improvements that can cause a valid journal to be rejected. - Fix an O_SYNC write handling bug reported by Christoph Hellwig. -----BEGIN PGP SIGNATURE----- iQJIBAABCAAyFiEEJZs3krPW0xkhLMTc1b+f6wMTZToFAl49TKgUHGFncnVlbmJh QHJlZGhhdC5jb20ACgkQ1b+f6wMTZTqG4RAAmXJfWI7UskM3ZRSVivbBwc0R3P9h PgdgeXlr/k4mJ2I421/btln614l4nD+JuG/FplOvj2m3YCzeKj2W+OiSxqahmwGm 7yGb0sFHjx6wZcID37mig5aqo2MJYI0xTAR6rSI2tAA7E/B7KX8SfFIS2EWB2vLz +rzCawqUGWKCiS/tZTe6JlB0Aeg20oy0Y00p3gewMN0ILNqy0w9kA+LVOGQYyUmW rrad638czIXi7kugWvNo82vcoU140m3A6OTaINf3EaT8AmOtw+e4qyej+f82BiVS RIXWKI+uRSfKFE+aYkwTxQn0BCMor63QIs3aaDXyLZBqnhTywRsckK6O7iBLFVDb NQc86wxiHzDoWubXstV0lrlel5m5dHT0dUq8mVogj4kOtwOvejiDRopqtdGkdxA5 j8zFV6O8BRPUw5g7MS37n9myuTNRj5q3L2vmN2xZ6fZmHykorwbwLbw0WMeAQ/4i pQh4NGE6h/lSPZIa/ZVCH8hwj2b41ZtAQK3k8G5IhNUhMHNkU8iynTbddoHFPsOF 67hj/aAycDx2NA6j/suS8PGt7PPU+VwwoDLKIG64bTHFTpwnRDNzZDt9wPIB9sGu P4QlSQYPrLf/u8+TD8yv2VJsyAEMFl1UQWbxqf6EzLtKjRM/TIoQsdRUF7upqUnN k5CM8FgmfYpIiFQ= =+6PA -----END PGP SIGNATURE----- Merge tag 'gfs2-for-5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 Pull gfs2 fixes from Andreas Gruenbacher: - Fix a bug in Abhi Das's journal head lookup improvements that can cause a valid journal to be rejected. - Fix an O_SYNC write handling bug reported by Christoph Hellwig. * tag 'gfs2-for-5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: fix O_SYNC write handling gfs2: move setting current->backing_dev_info gfs2: fix gfs2_find_jhead that returns uninitialized jhead with seq 0
This commit is contained in:
Коммит
175787e011
|
@ -847,7 +847,7 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
|||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
ssize_t written = 0, ret;
|
||||
ssize_t ret;
|
||||
|
||||
ret = gfs2_rsqa_alloc(ip);
|
||||
if (ret)
|
||||
|
@ -867,68 +867,58 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
|||
inode_lock(inode);
|
||||
ret = generic_write_checks(iocb, from);
|
||||
if (ret <= 0)
|
||||
goto out;
|
||||
|
||||
/* We can write back this queue in page reclaim */
|
||||
current->backing_dev_info = inode_to_bdi(inode);
|
||||
goto out_unlock;
|
||||
|
||||
ret = file_remove_privs(file);
|
||||
if (ret)
|
||||
goto out2;
|
||||
goto out_unlock;
|
||||
|
||||
ret = file_update_time(file);
|
||||
if (ret)
|
||||
goto out2;
|
||||
goto out_unlock;
|
||||
|
||||
if (iocb->ki_flags & IOCB_DIRECT) {
|
||||
struct address_space *mapping = file->f_mapping;
|
||||
loff_t pos, endbyte;
|
||||
ssize_t buffered;
|
||||
ssize_t buffered, ret2;
|
||||
|
||||
written = gfs2_file_direct_write(iocb, from);
|
||||
if (written < 0 || !iov_iter_count(from))
|
||||
goto out2;
|
||||
ret = gfs2_file_direct_write(iocb, from);
|
||||
if (ret < 0 || !iov_iter_count(from))
|
||||
goto out_unlock;
|
||||
|
||||
ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
|
||||
if (unlikely(ret < 0))
|
||||
goto out2;
|
||||
buffered = ret;
|
||||
iocb->ki_flags |= IOCB_DSYNC;
|
||||
current->backing_dev_info = inode_to_bdi(inode);
|
||||
buffered = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
|
||||
current->backing_dev_info = NULL;
|
||||
if (unlikely(buffered <= 0))
|
||||
goto out_unlock;
|
||||
|
||||
/*
|
||||
* We need to ensure that the page cache pages are written to
|
||||
* disk and invalidated to preserve the expected O_DIRECT
|
||||
* semantics.
|
||||
* semantics. If the writeback or invalidate fails, only report
|
||||
* the direct I/O range as we don't know if the buffered pages
|
||||
* made it to disk.
|
||||
*/
|
||||
pos = iocb->ki_pos;
|
||||
endbyte = pos + buffered - 1;
|
||||
ret = filemap_write_and_wait_range(mapping, pos, endbyte);
|
||||
if (!ret) {
|
||||
iocb->ki_pos += buffered;
|
||||
written += buffered;
|
||||
invalidate_mapping_pages(mapping,
|
||||
pos >> PAGE_SHIFT,
|
||||
endbyte >> PAGE_SHIFT);
|
||||
} else {
|
||||
/*
|
||||
* We don't know how much we wrote, so just return
|
||||
* the number of bytes which were direct-written
|
||||
*/
|
||||
}
|
||||
iocb->ki_pos += buffered;
|
||||
ret2 = generic_write_sync(iocb, buffered);
|
||||
invalidate_mapping_pages(mapping,
|
||||
(iocb->ki_pos - buffered) >> PAGE_SHIFT,
|
||||
(iocb->ki_pos - 1) >> PAGE_SHIFT);
|
||||
if (!ret || ret2 > 0)
|
||||
ret += ret2;
|
||||
} else {
|
||||
current->backing_dev_info = inode_to_bdi(inode);
|
||||
ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
|
||||
if (likely(ret > 0))
|
||||
current->backing_dev_info = NULL;
|
||||
if (likely(ret > 0)) {
|
||||
iocb->ki_pos += ret;
|
||||
ret = generic_write_sync(iocb, ret);
|
||||
}
|
||||
}
|
||||
|
||||
out2:
|
||||
current->backing_dev_info = NULL;
|
||||
out:
|
||||
out_unlock:
|
||||
inode_unlock(inode);
|
||||
if (likely(ret > 0)) {
|
||||
/* Handle various SYNC-type writes */
|
||||
ret = generic_write_sync(iocb, ret);
|
||||
}
|
||||
return written ? written : ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
|
||||
|
|
|
@ -422,7 +422,7 @@ static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd,
|
|||
|
||||
for (offset = 0; offset < PAGE_SIZE; offset += sdp->sd_sb.sb_bsize) {
|
||||
if (!__get_log_header(sdp, kaddr + offset, 0, &lh)) {
|
||||
if (lh.lh_sequence > head->lh_sequence)
|
||||
if (lh.lh_sequence >= head->lh_sequence)
|
||||
*head = lh;
|
||||
else {
|
||||
ret = true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче