aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r--fs/ocfs2/inode.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 7e9e4c79aec7..99f012a0f207 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -219,6 +219,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
219 struct super_block *sb; 219 struct super_block *sb;
220 struct ocfs2_super *osb; 220 struct ocfs2_super *osb;
221 int status = -EINVAL; 221 int status = -EINVAL;
222 int use_plocks = 1;
222 223
223 mlog_entry("(0x%p, size:%llu)\n", inode, 224 mlog_entry("(0x%p, size:%llu)\n", inode,
224 (unsigned long long)le64_to_cpu(fe->i_size)); 225 (unsigned long long)le64_to_cpu(fe->i_size));
@@ -226,6 +227,10 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
226 sb = inode->i_sb; 227 sb = inode->i_sb;
227 osb = OCFS2_SB(sb); 228 osb = OCFS2_SB(sb);
228 229
230 if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) ||
231 ocfs2_mount_local(osb) || !ocfs2_stack_supports_plocks())
232 use_plocks = 0;
233
229 /* this means that read_inode cannot create a superblock inode 234 /* this means that read_inode cannot create a superblock inode
230 * today. change if needed. */ 235 * today. change if needed. */
231 if (!OCFS2_IS_VALID_DINODE(fe) || 236 if (!OCFS2_IS_VALID_DINODE(fe) ||
@@ -295,13 +300,19 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
295 300
296 switch (inode->i_mode & S_IFMT) { 301 switch (inode->i_mode & S_IFMT) {
297 case S_IFREG: 302 case S_IFREG:
298 inode->i_fop = &ocfs2_fops; 303 if (use_plocks)
304 inode->i_fop = &ocfs2_fops;
305 else
306 inode->i_fop = &ocfs2_fops_no_plocks;
299 inode->i_op = &ocfs2_file_iops; 307 inode->i_op = &ocfs2_file_iops;
300 i_size_write(inode, le64_to_cpu(fe->i_size)); 308 i_size_write(inode, le64_to_cpu(fe->i_size));
301 break; 309 break;
302 case S_IFDIR: 310 case S_IFDIR:
303 inode->i_op = &ocfs2_dir_iops; 311 inode->i_op = &ocfs2_dir_iops;
304 inode->i_fop = &ocfs2_dops; 312 if (use_plocks)
313 inode->i_fop = &ocfs2_dops;
314 else
315 inode->i_fop = &ocfs2_dops_no_plocks;
305 i_size_write(inode, le64_to_cpu(fe->i_size)); 316 i_size_write(inode, le64_to_cpu(fe->i_size));
306 break; 317 break;
307 case S_IFLNK: 318 case S_IFLNK: