[PVFS2-CVS] commit by robl in pvfs2-1/src/kernel/linux-2.6: namei.c
pvfs2-utils.c
CVS commit program
cvs at parl.clemson.edu
Tue Jul 12 15:12:58 EDT 2005
Update of /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6
In directory parlweb:/tmp/cvs-serv24907
Modified Files:
namei.c pvfs2-utils.c
Log Message:
[pcarns]: force the st_nlink field to stay fixed at 1. The find(1) program
will get confused if we fix the field at 2 and quit too early.
"The "normal" semantic is for st_nlink to provide a count of how many
subdirectories are within a directory, including "." and "..", but not
including files. Prior to this patch, pvfs2 tried to maintain this, but the
count was a little off, and it couldn't keep up with subdirs added or removed
by other clients anyway. This led to negative st_nlink counts, with some
possibly odd side effects.
"Making st_nlink track the "right" value would be very expensive in pvfs2
because you might cross meta servers to get the information, and is of
dubious practical use anyway :) For historical reference, PVFS1 kept
this value fixed as well"
Index: namei.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/namei.c,v
diff -u -w -p -u -r1.62 -r1.63
--- namei.c 11 Jul 2005 22:19:10 -0000 1.62
+++ namei.c 12 Jul 2005 18:12:58 -0000 1.63
@@ -304,7 +304,12 @@ static int pvfs2_mkdir(
if (inode)
{
+#if 0
+ /* NOTE: we have no good way to keep nlink consistent for directories
+ * across clients; keep constant at 1 -Phil
+ */
dir->i_nlink++;
+#endif
pvfs2_update_inode_time(dir);
ret = 0;
}
@@ -322,7 +327,12 @@ static int pvfs2_rmdir(
if (ret == 0)
{
inode->i_nlink--;
+#if 0
+ /* NOTE: we have no good way to keep nlink consistent for directories
+ * across clients; keep constant at 1 -Phil
+ */
dir->i_nlink--;
+#endif
pvfs2_update_inode_time(dir);
}
return ret;
@@ -346,6 +356,10 @@ static int pvfs2_rename(
atomic_read(&new_dentry->d_count));
are_directories = S_ISDIR(old_dentry->d_inode->i_mode);
+#if 0
+ /* NOTE: we have no good way to keep nlink consistent for directories
+ * across clients; keep constant at 1 -Phil
+ */
if (are_directories && (new_dir->i_nlink >= PVFS2_LINK_MAX))
{
pvfs2_error("pvfs2_rename: directory %s surpassed "
@@ -353,6 +367,7 @@ static int pvfs2_rename(
new_dentry->d_name.name);
return -EMLINK;
}
+#endif
new_op = op_alloc();
if (!new_op)
@@ -412,16 +427,26 @@ static int pvfs2_rename(
if (new_dentry->d_inode)
{
new_dentry->d_inode->i_ctime = CURRENT_TIME;
+#if 0
+ /* NOTE: we have no good way to keep nlink consistent for directories
+ * across clients; keep constant at 1 -Phil
+ */
if (are_directories)
{
new_dentry->d_inode->i_nlink--;
}
+#endif
}
+#if 0
+ /* NOTE: we have no good way to keep nlink consistent for directories
+ * across clients; keep constant at 1 -Phil
+ */
else if (are_directories)
{
new_dir->i_nlink++;
old_dir->i_nlink--;
}
+#endif
error_exit:
translate_error_if_wait_failed(ret, 0, 0);
Index: pvfs2-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/kernel/linux-2.6/pvfs2-utils.c,v
diff -u -w -p -u -r1.98 -r1.99
--- pvfs2-utils.c 7 Jul 2005 22:12:10 -0000 1.98
+++ pvfs2-utils.c 12 Jul 2005 18:12:58 -0000 1.99
@@ -174,6 +174,11 @@ static inline int copy_attributes_to_ino
inode->i_mode |= S_IFDIR;
inode->i_op = &pvfs2_dir_inode_operations;
inode->i_fop = &pvfs2_dir_operations;
+ /* NOTE: we have no good way to keep nlink consistent for
+ * directories across clients; keep constant at 1. Why 1? If
+ * we go with 2, then find(1) gets confused and won't work
+ * properly withouth the -noleaf option */
+ inode->i_nlink = 1;
ret = 0;
break;
case PVFS_TYPE_SYMLINK:
More information about the PVFS2-CVS
mailing list