aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r--fs/udf/file.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c
index c02a27a19c6d..1037637957c7 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -144,6 +144,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
144 size_t count = iocb->ki_nbytes; 144 size_t count = iocb->ki_nbytes;
145 struct udf_inode_info *iinfo = UDF_I(inode); 145 struct udf_inode_info *iinfo = UDF_I(inode);
146 146
147 mutex_lock(&inode->i_mutex);
147 down_write(&iinfo->i_data_sem); 148 down_write(&iinfo->i_data_sem);
148 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { 149 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
149 if (file->f_flags & O_APPEND) 150 if (file->f_flags & O_APPEND)
@@ -156,6 +157,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
156 pos + count)) { 157 pos + count)) {
157 err = udf_expand_file_adinicb(inode); 158 err = udf_expand_file_adinicb(inode);
158 if (err) { 159 if (err) {
160 mutex_unlock(&inode->i_mutex);
159 udf_debug("udf_expand_adinicb: err=%d\n", err); 161 udf_debug("udf_expand_adinicb: err=%d\n", err);
160 return err; 162 return err;
161 } 163 }
@@ -169,9 +171,17 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
169 } else 171 } else
170 up_write(&iinfo->i_data_sem); 172 up_write(&iinfo->i_data_sem);
171 173
172 retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); 174 retval = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos);
173 if (retval > 0) 175 mutex_unlock(&inode->i_mutex);
176
177 if (retval > 0) {
178 ssize_t err;
179
174 mark_inode_dirty(inode); 180 mark_inode_dirty(inode);
181 err = generic_write_sync(file, iocb->ki_pos - retval, retval);
182 if (err < 0)
183 retval = err;
184 }
175 185
176 return retval; 186 return retval;
177} 187}