Why generic_fillattr() is not protected with a lock?

From: Xin Zhao
Date: Thu Aug 24 2006 - 22:05:49 EST


Hi,

I noticed that almost all local disk file systems use the default
vfs_getattr()->generic_fillattr() to get file attributes. However,
vfs_getattr()->generic_fillattr() is not protected by a lock. Is this
problematic?

Suppose process A is getting file attributes, after it read the
"mtime" and before it read the i_size, the process is scheduled out,
and another process B cuts in, change the file, and cause the change
on file size. After A is switched back, it goes ahead to read the rest
fields. Now it will have an old "mtime" but a new "i_size".

Is this scenario possible? If so, will this cause serious problem to
the file system?

Thanks,
Xin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/