ceph: fix append mode write
generic_write_checks() may update 'pos', so we need to pass 'pos' to ceph_sync_write() and ceph_sync_direct_write(); Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
This commit is contained in:
Родитель
7e8a295295
Коммит
06fee30f6a
|
@ -537,7 +537,7 @@ static void ceph_sync_write_unsafe(struct ceph_osd_request *req, bool unsafe)
|
||||||
* objects, rollback on failure, etc.)
|
* objects, rollback on failure, etc.)
|
||||||
*/
|
*/
|
||||||
static ssize_t
|
static ssize_t
|
||||||
ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from)
|
ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos)
|
||||||
{
|
{
|
||||||
struct file *file = iocb->ki_filp;
|
struct file *file = iocb->ki_filp;
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
|
@ -553,7 +553,6 @@ ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from)
|
||||||
int check_caps = 0;
|
int check_caps = 0;
|
||||||
int ret;
|
int ret;
|
||||||
struct timespec mtime = CURRENT_TIME;
|
struct timespec mtime = CURRENT_TIME;
|
||||||
loff_t pos = iocb->ki_pos;
|
|
||||||
size_t count = iov_iter_count(from);
|
size_t count = iov_iter_count(from);
|
||||||
|
|
||||||
if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
|
if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
|
||||||
|
@ -652,7 +651,8 @@ ceph_sync_direct_write(struct kiocb *iocb, struct iov_iter *from)
|
||||||
* correct atomic write, we should e.g. take write locks on all
|
* correct atomic write, we should e.g. take write locks on all
|
||||||
* objects, rollback on failure, etc.)
|
* objects, rollback on failure, etc.)
|
||||||
*/
|
*/
|
||||||
static ssize_t ceph_sync_write(struct kiocb *iocb, struct iov_iter *from)
|
static ssize_t
|
||||||
|
ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos)
|
||||||
{
|
{
|
||||||
struct file *file = iocb->ki_filp;
|
struct file *file = iocb->ki_filp;
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
|
@ -669,7 +669,6 @@ static ssize_t ceph_sync_write(struct kiocb *iocb, struct iov_iter *from)
|
||||||
int check_caps = 0;
|
int check_caps = 0;
|
||||||
int ret;
|
int ret;
|
||||||
struct timespec mtime = CURRENT_TIME;
|
struct timespec mtime = CURRENT_TIME;
|
||||||
loff_t pos = iocb->ki_pos;
|
|
||||||
size_t count = iov_iter_count(from);
|
size_t count = iov_iter_count(from);
|
||||||
|
|
||||||
if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
|
if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
|
||||||
|
@ -924,9 +923,9 @@ retry_snap:
|
||||||
/* we might need to revert back to that point */
|
/* we might need to revert back to that point */
|
||||||
data = *from;
|
data = *from;
|
||||||
if (file->f_flags & O_DIRECT)
|
if (file->f_flags & O_DIRECT)
|
||||||
written = ceph_sync_direct_write(iocb, &data);
|
written = ceph_sync_direct_write(iocb, &data, pos);
|
||||||
else
|
else
|
||||||
written = ceph_sync_write(iocb, &data);
|
written = ceph_sync_write(iocb, &data, pos);
|
||||||
if (written == -EOLDSNAPC) {
|
if (written == -EOLDSNAPC) {
|
||||||
dout("aio_write %p %llx.%llx %llu~%u"
|
dout("aio_write %p %llx.%llx %llu~%u"
|
||||||
"got EOLDSNAPC, retrying\n",
|
"got EOLDSNAPC, retrying\n",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче