[Ocfs2-commits] mfasheh commits r1325 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Aug 3 14:55:51 CDT 2004
Author: mfasheh
Date: 2004-08-03 13:55:49 -0500 (Tue, 03 Aug 2004)
New Revision: 1325
Modified:
trunk/src/inode.c
Log:
* work around a bug we have in symlink where we use the buffer cache
pages for data, but the kernel later uses page cache pages for the
symlink data. The real fix needs to be a reworking of the way we do
symlink data in ocfs_create_symlink_data().
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-08-03 18:54:28 UTC (rev 1324)
+++ trunk/src/inode.c 2004-08-03 18:55:49 UTC (rev 1325)
@@ -1007,6 +1007,9 @@
int status;
ocfs2_dinode *fe = NULL;
struct buffer_head *bh = NULL;
+ struct buffer_head *buffer_cache_bh = NULL;
+ ocfs_super *osb = OCFS_SB(inode->i_sb);
+ void *kaddr;
LOG_ENTRY_ARGS ("(0x%p, %llu, 0x%p, %d)\n", inode,
(unsigned long long)iblock, bh_result, create);
@@ -1045,6 +1048,36 @@
goto bail;
}
+ /* We don't use the page cache to create symlink data, so if
+ * need be, copy it over from the buffer cache. */
+ if (!buffer_uptodate(bh_result) && !ocfs_inode_is_new(osb, inode)) {
+ buffer_cache_bh = sb_getblk(osb->sb,
+ fe->id2.i_list.l_recs[0].e_blkno + iblock);
+ if (!buffer_cache_bh) {
+ LOG_ERROR_STR("couldn't getblock for symlink!");
+ goto bail;
+ }
+
+ /* we haven't locked out transactions, so a commit
+ * could've happened. Since we've got a reference on
+ * the bh, even if it commits while we're doing the
+ * copy, the data is still good. */
+ if (buffer_jbd(buffer_cache_bh)
+ && !ocfs_inode_is_new(osb, inode)) {
+ kaddr = kmap_atomic(bh_result->b_page, KM_USER0);
+ if (!kaddr) {
+ LOG_ERROR_ARGS("couldn't kmap!\n");
+ goto bail;
+ }
+ memcpy(kaddr + (bh_result->b_size * iblock),
+ buffer_cache_bh->b_data,
+ bh_result->b_size);
+ kunmap_atomic(kaddr, KM_USER0);
+ set_buffer_uptodate(bh_result);
+ }
+ brelse(buffer_cache_bh);
+ }
+
map_bh(bh_result, inode->i_sb,
fe->id2.i_list.l_recs[0].e_blkno + iblock);
More information about the Ocfs2-commits
mailing list