Add UFS_LINK_MAX for the UFS-specific limit on link counts.

ino64 expanded nlink_t to 64 bits, but the on-disk format for UFS is still
limited to 16 bits.  This is a nop currently but will matter if LINK_MAX is
increased in the future.

Reviewed by:	kib
Sponsored by:	Chelsio Communications
This commit is contained in:
John Baldwin 2017-09-18 23:30:39 +00:00
parent 5efe338f3d
commit 4f45713ae2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323723
3 changed files with 10 additions and 5 deletions

View File

@ -11532,7 +11532,7 @@ handle_written_inodeblock(inodedep, bp, flags)
*/
if (inodedep->id_savedsize == -1 || inodedep->id_savedextsize == -1)
panic("handle_written_inodeblock: bad size");
if (inodedep->id_savednlink > LINK_MAX)
if (inodedep->id_savednlink > UFS_LINK_MAX)
panic("handle_written_inodeblock: Invalid link count "
"%jd for inodedep %p", (uintmax_t)inodedep->id_savednlink,
inodedep);

View File

@ -186,4 +186,6 @@ struct ufs1_dinode {
u_int64_t di_modrev; /* 120: i_modrev for NFSv4 */
};
#define UFS_LINK_MAX 32767
#endif /* _UFS_UFS_DINODE_H_ */

View File

@ -981,7 +981,7 @@ ufs_link(ap)
goto out;
}
ip = VTOI(vp);
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
if (ip->i_nlink >= UFS_LINK_MAX) {
error = EMLINK;
goto out;
}
@ -1266,7 +1266,7 @@ ufs_rename(ap)
doingdirectory = 0;
newparent = 0;
ino = fip->i_number;
if (fip->i_nlink >= LINK_MAX) {
if (fip->i_nlink >= UFS_LINK_MAX) {
error = EMLINK;
goto unlockout;
}
@ -1369,7 +1369,7 @@ ufs_rename(ap)
* actual link modification is completed when
* .. is rewritten below.
*/
if ((nlink_t)tdp->i_nlink >= LINK_MAX) {
if (tdp->i_nlink >= UFS_LINK_MAX) {
error = EMLINK;
goto bad;
}
@ -1793,7 +1793,7 @@ ufs_mkdir(ap)
panic("ufs_mkdir: no name");
#endif
dp = VTOI(dvp);
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
if (dp->i_nlink >= UFS_LINK_MAX) {
error = EMLINK;
goto out;
}
@ -2442,6 +2442,9 @@ ufs_pathconf(ap)
error = 0;
switch (ap->a_name) {
case _PC_LINK_MAX:
*ap->a_retval = UFS_LINK_MAX;
break;
case _PC_NAME_MAX:
*ap->a_retval = UFS_MAXNAMLEN;
break;