->=========================================================
+=========================================================
¤³¤ì¤Ï¡¢
-Linux-2.6.29/Documentation/filesystems/files.txt ¤ÎÏÂÌõ¤Ç¤¹¡£
-ËÝÌõÃÄÂΡ§ JF ¥×¥í¥¸¥§¥¯¥È < http://www.linux.or.jp/JF/ >
-¹¹¿·Æü ¡§ 2009/05/26
+Linux-3.5/Documentation/filesystems/files.txt ¤ÎÏÂÌõ¤Ç¤¹¡£
+ËÝÌõÃÄÂΡ§ JF ¥×¥í¥¸¥§¥¯¥È < http://linuxjf.sourceforge.jp/ >
+¹¹¿·Æü ¡§ 2012/09/04
ËÝÌõ¼Ô ¡§ Seiji Kaneko < skaneko at mbn dot or dot jp >
ººÆÉ¼Ô ¡§ Masanori Kobayashi <zap03216 at nifty dot ne dot jp >
=========================================================
¤Þ¤¿¡¢->count ¤¬ CLONE_FILES ¥Õ¥é¥°¤Ä¤¤ÇÊ£À½¤µ¤ì¤¿¥¿¥¹¥¯´Ö¤Ç¤Î¡¢¥Õ¥¡¥¤¥ë
¥Ç¥£¥¹¥¯¥ê¥×¥¿¥Æ¡¼¥Ö¥ë¤Î¶¦Í¤ËÍѤ¤¤é¤ì¤Æ¤¤¤Þ¤·¤¿¡£Ä̾posix ¥¹¥ì¥Ã¥É¤¬
¤³¤Î¾ì¹ç¤ËÅö¤¿¤ê¤Þ¤¹¡£¥«¡¼¥Í¥ëÆâ¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¥«¥¦¥ó¥È¶¦ÄÌ¥â¥Ç¥ë¤Ë±è¤Ã¤Æ¡¢
-put_files_struct() ¤òºÇ¸å¤Ë¹Ô¤Ã¤¿¥¿¥¹¥¯¤¬¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿ (fd)
-¥Æ¡¼¥Ö¥ë¤ò²òÊü¤·¤Þ¤¹¡£¥Õ¥¡¥¤¥ë (struct file) ¼«ÂΤϡ¢¥ê¥Õ¥¡¥ì¥ó¥¹¥«¥¦¥ó¥È
+put_files_struct() ¤òºÇ¸å¤Ë¹Ô¤Ã¤¿¥¿¥¹¥¯¤¬¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿ (fd)
+¥Æ¡¼¥Ö¥ë¤ò²òÊü¤·¤Þ¤¹¡£¥Õ¥¡¥¤¥ë (struct file) ¼«ÂΤϡ¢¥ê¥Õ¥¡¥ì¥ó¥¹¥«¥¦¥ó¥È
(->f_count) ¤ò»È¤Ã¤ÆÊݸ¤ì¤Æ¤¤¤Þ¤¹¡£
#In the new lock-free model of file descriptor management,
#the fdtable structure -
¿·¤·¤¤¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿´ÉÍý¤Î¥í¥Ã¥¯¥Õ¥ê¡¼¥â¥Ç¥ë¤Ç¤Ï¡¢¥ê¥Õ¥¡¥ì¥ó¥¹¥«
¥¦¥ó¥È¤Ë¤è¤ë´ÉÍý¤Ï½¾Íè¤ÈƱÍͤǤ¹¤¬¡¢¥í¥Ã¥¯½èÍý¤Ï RCU ¤Ë´ð¤Å¤¯¤â¤Î¤Ë¤Ê¤ê¤Þ
-¤¹¡£¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¥Æ¡¼¥Ö¥ë¤Ë¤ÏÊ£¿ô¤ÎÍ×ÁÇ - fd °ì¼° (open_fd ·²¤ä
+¤¹¡£¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¥Æ¡¼¥Ö¥ë¤Ë¤ÏÊ£¿ô¤ÎÍ×ÁÇ - fd °ì¼° (open_fd ·²¤ä
close_on_exec, file ¥Ý¥¤¥ó¥¿¤ÎÇÛÎó, ÁȤäÇÛÎó¤Î¿ô¤ä¥µ¥¤¥º¤Ê¤É) - ¤¬³ÊǼ¤µ
¤ì¤Æ¤¤¤Þ¤¹¡£¥í¥Ã¥¯¤ò»ý¤¿¤Ê¤¤Æɤ߽Ф·Â¦¤«¤é¹¹¿·¤¬¥¢¥È¥ß¥Ã¥¯¤Ç¤¢¤ë¤è¤¦¤Ë¸«
¤»¤ë¤¿¤á¤Ë¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¥Æ¡¼¥Ö¥ë¤Î³ÆÍ×ÁǤϤ¹¤Ù¤ÆÆÈΩ¤·¤¿°ì¤Ä¤Î
#3. For any update to the fd table, files->file_lock must
# be held.
-3. fd ¥Æ¡¼¥Ö¥ë¤ò¹¹¿·¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢¤É¤Î¤è¤¦¤Ê¹¹¿·¤Ç¤â files->file_lock
+3. fd ¥Æ¡¼¥Ö¥ë¤ò¹¹¿·¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢¤É¤Î¤è¤¦¤Ê¹¹¿·¤Ç¤â files->file_lock
¤ò»ý¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤¤¤±¤Þ¤»¤ó¡£
#4. To look up the file structure given an fd, a reader
# that look-up may race with the last put() operation on the
# file structure. This is avoided using atomic_long_inc_not_zero()
# on ->f_count :
-5. ¥Õ¥¡¥¤¥ë¹½Â¤ÂΤÎÁàºî¤Ë¤ÏÆÃÊ̤ÎÃí°Õ¤¬É¬ÍפǤ¹¡£fd ¤Î¸¡º÷
+5. ¥Õ¥¡¥¤¥ë¹½Â¤ÂΤÎÁàºî¤Ë¤ÏÆÃÊ̤ÎÃí°Õ¤¬É¬ÍפǤ¹¡£fd ¤Î¸¡º÷
(fget()/fget_light()) ¤Ï¥í¥Ã¥¯¤ò¤È¤ê¤Þ¤»¤ó¤«¤é¡¢¸¡º÷»þ¤Ë¥Õ¥¡¥¤¥ë¹½
- ¤ÂΤؤκǸå¤Î put() Áàºî¤È¶¥¹ç¤òµ¯¤³¤¹²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤Ï
+ ¤ÂΤؤκǸå¤Î put() Áàºî¤È¶¥¹ç¤òµ¯¤³¤¹²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤Ï
->f_count ¤ËÂФ·¤Æ atomic_long_inc_not_zero() ¤òÍѤ¤¤ë¤³¤È¤Ë¤è¤Ã
¤Æ²óÈò¤·¤Þ¤¹¡£
6. fdtable ¤È file ¹½Â¤ÂΤΤ¤¤º¤ì¤â¤¬¥í¥Ã¥¯¤ò¤È¤é¤Ê¤¤¤Ç»²¾È²Äǽ¤Ç¤¹¤«¤é¡¢
¤³¤ì¤é¤Ë¤Ä¤¤¤Æ¤Ï rcu_assign_pointer() API ¤òÍѤ¤¤Æ¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ëɬ
Íפ¬¤¢¤ê¤Þ¤¹¡£¥í¥Ã¥¯¤ò¤È¤é¤Ê¤¤¤Ç»²¾È¤¹¤ë¾ì¹ç¡¢rcu_dereference() ¤ò»È
- ¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£¤¿¤À¤·¡¢files_fdtable() ¤È fcheck()/fcheck_files()
+ ¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£¤¿¤À¤·¡¢files_fdtable() ¤È fcheck()/fcheck_files()
¤Ï¤³¤ì¤é¤ÎÌÌÅݤò¸«¤Æ¤¯¤ì¤Þ¤¹¤Î¤Ç¡¢¤³¤ì¤ò»È¤¦¤Î¤¬¤ª¤¹¤¹¤á¤Ç¤¹¡£
#7. While updating, the fdtable pointer must be looked up while
if (fd >= 0) {
/* locate_fd() may have expanded fdtable, load the ptr */
fdt = files_fdtable(files);
- FD_SET(fd, fdt->open_fds);
- FD_CLR(fd, fdt->close_on_exec);
+ __set_open_fd(fd, fdt);
+ __clear_close_on_exec(fd, fdt);
spin_unlock(&files->file_lock);
.....
# Since locate_fd() can drop ->file_lock (and reacquire ->file_lock),
# the fdtable pointer (fdt) must be loaded after locate_fd().
locate_fd() ¤¬ ->file_lock ¤ò²òÊü¤·¤Æ (¤½¤Î¸å ->file_lock ¤òºÆ¼è
- ÆÀ¤¹¤ë) ²ÄǽÀ¤¬¤¢¤ë¤¿¤á¡¢fdtable ¥Ý¥¤¥ó¥¿ (fdt) ¤Ï locate_fd()
+ ÆÀ¤¹¤ë) ²ÄǽÀ¤¬¤¢¤ë¤¿¤á¡¢fdtable ¥Ý¥¤¥ó¥¿ (fdt) ¤Ï locate_fd()
¼Â¹Ô¸å¤Ë¥í¡¼¥É¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
+